Skip to content
Snippets Groups Projects
Commit 085f8f85 authored by Matthew Webster's avatar Matthew Webster
Browse files

improved -k mem requirements for 3D mask

parent d12fdfd5
No related branches found
No related tags found
No related merge requests found
......@@ -130,13 +130,15 @@ int generate_masks(volume4D<float> &mask, volume4D<float> &masknz, const volume4
if (!lthr_used) { lthr=vin.min()-1; }
if (!uthr_used) { uthr=vin.max()+1; }
mask = binarise(vin,lthr,uthr,exclusive);
masknz = mask * (1.0f - binarise(vin,0.0f, 0.0f));
if (mask.tsize()!=1) masknz = (binarise(vin,0.0f, 0.0f)-1.0f)*-1.0f*mask;
else masknz = (binarise(vin,0.0f, 0.0f)-1.0f)*mask[0];
return 0;
}
int generate_masks(const volume4D<float> &mask, volume4D<float> &masknz, const volume4D<float> &vin)
{
masknz = mask * (1.0f - binarise(vin,0.0f, 0.0f));
if (mask.tsize()!=1) masknz = (binarise(vin,0.0f, 0.0f)-1.0f)*-1.0f*mask;
else masknz = (binarise(vin,0.0f, 0.0f)-1.0f)*mask[0];
return 0;
}
......@@ -273,7 +275,7 @@ int fmrib_main_float(int argc, char* argv[])
cerr << "Mask and image must be the same size" << endl;
exit(3);
}
if ( mask.tsize() != vol.tsize() ) {
if ( mask.tsize() != vol.tsize() && mask.tsize() != 1) {
// copy the last max volume until the correct size is reached
while (mask.tsize() < vol.tsize() ) {
mask.addvolume(mask[mask.maxt()]);
......@@ -290,7 +292,8 @@ int fmrib_main_float(int argc, char* argv[])
mask.binarise(1);
}
generate_masks(mask,masknz,vin);
vol = vin * mask;
if (mask.tsize()!=1) vol=vin*mask;
else vol=vin*mask[0];
} else if (sarg=="-l") {
narg++;
if (narg<argc) {
......
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