Skip to content
Snippets Groups Projects
Commit fcf875f5 authored by Mark Jenkinson's avatar Mark Jenkinson
Browse files

Fixed crash which occured in Infer

parent 7cc209dc
No related branches found
No related tags found
No related merge requests found
...@@ -85,12 +85,6 @@ Option<string> talvolname(string("--talvol"), string(""), ...@@ -85,12 +85,6 @@ Option<string> talvolname(string("--talvol"), string(""),
string("filename for talairach volume"), string("filename for talairach volume"),
false, requires_argument); false, requires_argument);
template <class T>
void print_dims(const volume<T>& vol)
{
cout << "dims=(" << vol.xdim()*vol.xsign() << ","
<< vol.ydim()*vol.ysign() << "," << vol.zdim()*vol.zsign() << ")";
}
template <class T> template <class T>
...@@ -377,7 +371,7 @@ int fmrib_main(int argc, char *argv[]) ...@@ -377,7 +371,7 @@ int fmrib_main(int argc, char *argv[])
// read in the volume // read in the volume
volume<T> zvol, mask, cope; volume<T> zvol, mask, cope;
read_volume(zvol,inputname.value()); read_volume(zvol,inputname.value());
if (verbose.value()) {cout<<"Zvol: "; print_dims(zvol); cout<<endl;} if (verbose.value()) print_volume_info(zvol,"Zvol");
if ( fractional.value() ) { if ( fractional.value() ) {
float frac = th; float frac = th;
...@@ -386,14 +380,15 @@ int fmrib_main(int argc, char *argv[]) ...@@ -386,14 +380,15 @@ int fmrib_main(int argc, char *argv[])
mask = zvol; mask = zvol;
mask.threshold((T) th); mask.threshold((T) th);
if (minv.value()) { mask = ((T) 1) - mask; } if (minv.value()) { mask = ((T) 1) - mask; }
if (verbose.value()) {cout<<"Mask: "; print_dims(mask); cout<<endl;} if (verbose.value()) print_volume_info(mask,"Mask");
// Find the connected components // Find the connected components
labelim = connected_components(mask,numconnected.value()); labelim = connected_components(mask,numconnected.value());
if (verbose.value()) {cout<<"Labelim: "; print_dims(labelim); cout<<endl;} if (verbose.value()) print_volume_info(labelim,"Labelim");
// process according to the output format // process according to the output format
get_stats(labelim,zvol,size,maxvals,meanvals,maxpos,cog,minv.value()); get_stats(labelim,zvol,size,maxvals,meanvals,maxpos,cog,minv.value());
if (verbose.value()) {cout<<"Number of labels = "<<size.size()<<endl;}
// process the cope image if entered // process the cope image if entered
vector<int> copesize; vector<int> copesize;
...@@ -414,6 +409,7 @@ int fmrib_main(int argc, char *argv[]) ...@@ -414,6 +409,7 @@ int fmrib_main(int argc, char *argv[])
pthreshsize = size; pthreshsize = size;
int nozeroclust=0; int nozeroclust=0;
if (!pthresh.unset()) { if (!pthresh.unset()) {
if (verbose.value()) {cout<<"Re-thresholding with p-value"<<endl;}
Infer infer(dLh.value(), th, voxvol.value()); Infer infer(dLh.value(), th, voxvol.value());
for (int n=1; n<length; n++) { for (int n=1; n<length; n++) {
int k = size[n]; int k = size[n];
...@@ -424,10 +420,12 @@ int fmrib_main(int argc, char *argv[]) ...@@ -424,10 +420,12 @@ int fmrib_main(int argc, char *argv[])
} }
} }
} }
if (verbose.value()) {cout<<"Number of sub-p clusters = "<<nozeroclust<<endl;}
// get sorted index (will revert to cluster size if no pthresh) // get sorted index (will revert to cluster size if no pthresh)
vector<int> idx; vector<int> idx;
idx = get_sortindex(pthreshsize); idx = get_sortindex(pthreshsize);
if (verbose.value()) {cout<<pthreshsize.size()<<" labels in sortedidx"<<endl;}
vector<int> threshidx(length); vector<int> threshidx(length);
for (int n=length-1; n>=1; n--) { for (int n=length-1; n>=1; n--) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment