Question

I have a large (3D) image I and a mask M of the same size. I want to use a filter on part of the image described by the mask, but calculating that filter is quite slow. I would like to take a rectangular sub-region volume out of I that contains all the voxels marked in M, apply my filter on that sub-region and then insert that processed subregion back into the appropriate place in M. Since this subregion will be much smaller than I, it will perform much faster.

I'd be surprised if there wasn't a existing ITK filter to find the subregion extents based on 'M', but I can't find it. Any suggestions?

Was it helpful?

Solution

You have quite a number of options. The simplest is to use the LabelStatisticsImageFilter. Then there is the LabelMap framework which has the ShapeLabelObject which can be transformed from a regular label image with LabelImageToShapeLabelMapFilter to the run-length encoded label object with attribute.

As you said you have a large image, so memory constrains and streaming may also be of interest to you. I have created an ITK External Module called itkStreamingSinc which contains a filter called BoundingRegionImageSinc to perform streaming and computation of just the bounding image region in an out of core streaming process.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top