Run length matrices

Hello,

I want to use the itk filter ScalarImageToRunLengthMatrixFilter for texture analysis. But I think there something with the filter that does not make sense for me. The filter only allows to set the same number of bins per axis. This does not make sence. For instance, if I have an image with the size 8001000 and 150 diferente grey levels, I will need a run lungth matrix with 1501000, since we can have runs up to 1000, and not a square matrix as the filter always does.

Is something missing me?
Regards,
Francisco

Hello @Francisco_Oliveira

I think you are right, that filter should allow to have different bin number per axis, if you want to have precise control of bin size (I guess you can still use it by setting the number to the lower value between the intensity range and the distance).
Modifying the filter to get the correct control seems easy enough however:
-change the m_NumberOfBinsPerAxis to array or something similar
-modify the histogram initialization to account for different sizes

(this might be not sufficient)

HTH,

Tim

Hello @Francisco_Oliveira

It might be a good idea to modify the filter in order to allow different number of bins for each axis of the matrix, but it will probably be tricky as it is used in other itk filters and probably other external codes.

Meanwhile, I think that @tim-evain suggestion of using SetPixelValueMinMax and SetDistanceValueMinMax in order to use the filter properly is a good idea. Take care when you set the distance, the units is millimeters not voxels.

I Hope it will help you!

Jb

1 Like

Thank you Tim and Jean for your suggestions

Since I need to have full control of the bin size, Iā€™m going to write a code to compute the Run Length Matrices and the features.

Regards,
Francisco