[ITK] Volume of one voxel

Wood, Tobias tobias.wood at kcl.ac.uk
Tue Dec 6 04:51:09 EST 2016


Hello,

Is there a more elegant way to calculate the volume of a single voxel in an image than:

    double vox_volume = img->GetSpacing()[0];
    for (int v = 1; v < 3; v++)
        vox_volume *= img->GetSpacing()[v];

(With appropriate dimensionality)

It feels like I’m missing something cleaner.

Toby



More information about the Community mailing list