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

Fixed problem with no mask

parent 21a4d6e2
No related branches found
No related tags found
No related merge requests found
......@@ -42,11 +42,12 @@ int main(int argc,char *argv[])
volume4D<float> vin;
read_volume4D(vin,argv[1]);
bool use_mask = false;
volume<float> mask;
if (argc>=4) {
use_mask = true;
read_volume(mask,argv[3]);
} else {
mask = vin[0];
mask = 1.0;
}
if (!samesize(vin[0],mask)) {
......@@ -63,8 +64,7 @@ int main(int argc,char *argv[])
for (int z=mask.minz(); z<mask.maxz(); z++) {
for (int y=mask.miny(); y<mask.maxy(); y++) {
for (int x=mask.minx(); x<mask.maxx(); x++) {
if ( (!use_mask) || (fabs(mask(x,y,z))>1e-8)) {
// arbitrary "0" threshold
if (fabs(mask(x,y,z))>1e-8) { // arbitrary "0" threshold
meants += vin.voxelts(x,y,z);
num++;
}
......@@ -72,6 +72,8 @@ int main(int argc,char *argv[])
}
}
cout << "Number of voxels used = " << num << endl;
// normalise for number of valid entries
meants /= (float) num;
......
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