I’m using the itkScalarImageToRunLengthMatrixFilter to extract texture features from brain images. I know that this particular class has the method SetMaskImage that can be used to constrain the region we want to extract features from. However, when I try to use it I always get blank images as a result. I’ve tried using masks with foreground values equal to 1 or equal to itk::NumericTraits< T >::max(), where T is the pixel type. All to no avail. When I don’t use a mask image, I get the expected outputs, but it’s really time-consuming.
Can someone please point me in the right direction? Using a mask to constrain the region to be processed would dramatically decrease the amount of time required to get the results I’m interested in.
I would recommend running your program under debugging, stepping into GetMaskImage() and inspecting relevant variables. That should give you a clue about what is wrong.
Thank you, @matt.mccormick. I’ve looked into it and I was able to run the RLM example, but I was still not able to get texture maps using masks (only using the whole image).
An ordinary pointer does not keep ownership of ITK’s reference counted classes such as Image, so the return value of the ReadImage function immediately goes out of scope, leaving mask_img a dangling pointer. It is pure luck that the program does not crash.