4

I have some DICOM images. I want to rescale them using IntensityWindowingImageFilter, but first, I need to know initial values of maximum and minimum intensities.

Right now, I am building WPF UI, with which I want to have some sliders to allow user to interactively input parameters for this operation. However, to have best user experience available, I need to limit scale on sliders to have maximimum and minimum that is maximum and minimum of intensity of image. In ITK, I could use MinimumMaximumImageCalculator, but I can't seem to find it in SimpleITK.

Of course, I could simply use Image.GetBufferAsXXX() and simply iterate over each pixel to find those values, but I am almost sure this is not a right way to go.

alkamid
  • 6,970
  • 4
  • 28
  • 39
Paweł Mach
  • 705
  • 1
  • 11
  • 23

1 Answers1

8

One can use MinimumMaximumImageFilter. I am not sure why thing used to get minimum and maximum is a filter, but well...

Usage:

MinimumMaximumImageFilter filter = new MinimumMaximumImageFilter();
filter.Execute(image);
this.ImageHighestIntensity = filter.GetMaximum();
this.ImageLowestIntensity = filter.GetMinimum();
filter.Dispose(); 
Paweł Mach
  • 705
  • 1
  • 11
  • 23
  • 1
    Glad that you have found answer to your own question. ;) – Ian Dec 27 '15 at 16:57
  • 5
    Well, it was kind of obvious. It had happened twice or thrice before for me, that I fought some problem for a while, asked a question here, to get an answer mere minutes later. But I hope somebody might find it useful someday, so I left it here. – Paweł Mach Dec 27 '15 at 17:05