ITK Pre-Processing Algorithm Wrappers in Python/ShiftScaleFilter

From FarsightWiki
Jump to: navigation, search

Shift and scale filter

This filter is implemented using the itkShiftScaleImageFilter in ITK. The filter shift the image pixels and scales them by a certain amount. Note that the shifting and scaling are performed on the image pixel values and does not refer to image scaling and shifting. Moreover, in order to observe the shifting and scaling operations, one would have to choose the output image pixel type to be float/double. Having an integer type, such as unsigned char or unsigned short integer may not show the results correctly.

Parameters:

  • 1. Shift - this parameter specifies the amount the pixels have to be shifted. One case where we would like to use the shift operator would be when we want the image to have zero mean. In that case, we would have to subtract the mean value of the image and this can be done using the shift parameter. Note that for subtracting, we will have to give a negative shift value to the pixels.
  • 2. Scale - this parameter specifies the amount by which the pixels have to be scaled after shifting. Shifting is often used when one wants to change the contrast of an image. However, note that if proper care is not taken while choosing the scaling parameter for the image, it could lead to pixel saturation (either too dark, or too bright).

Fig. 1 shows the application of shift scale filter on seg_orig with shift parameter of -40, and scale = 1. Note that the image looks darker. The black regions of the image have saturated at 0. The intensities of the other pixels has come down by 40. (Please note that the images have been stored as JPEG images, and the pixel intensities might vary slightly due to the compression involved. The TIF images generated did clearly show the pixel intensity difference of 40, compared to the original image.)

Back to main page.

Fig. 1: seg_orig pixel intensities shifted by -40. The pixel intensities saturate at 0.
Personal tools