Resampling Images

Jim can resample an existing image to have different numbers of slices, rows, columns and frames (for multi-frame images). The Resampler can crop images, resize image pixels, pad images to a larger size, reorient images to a different imaging plane and perform filtering operations.

When resizing pixels, if the number of samples that you request is less than the original, Jim will average pixel values to sub-sample the image. If the number of samples that you request is greater than the original, Jim will interpolate pixel values to create an image with greater (digital) resolution.

When resizing pixels, you can either specify the new pixel size, or the number of samples that you require. Jim will then work out the best resampling strategy.

To resample or filter an existing image, select Image Resampler from the Organise menu: organise_resampler of the main display frame. This brings up the Image Resampler tool:

image_resampler

The Image Resampler tool takes a single input image, and re-samples, filters or reorientates it to create a new image. The new image will be of the same type as the input image, but with possibly different numbers of samples (pixels) in each of its dimensions. The new image can either be saved to disk, or loaded into Jim depending on your selection:

load_save

Note: when performing more than one operation (cropping, filtering, resizing pixels, padding, flipping, rotating or re-orienting) the operations will be applied sequentially such that the cropped image is passed to the filter, which is passed to the pixel resize, which is passed to the rotator, which is passed to the flipper, which is passed to the padder, which is then passed on for rotation then reorientation, so that the specifications at each stage apply to the image that has been produced by the previous operation.

First select the Input Image by clicking on the open icon, or by typing in the folder (directory) and file name of the image, or by pressing the right mouse button and selecting from the menu of recently-used images.

input_image

Cropping

Cropping involves selecting only certain columns, rows, slices and frames of an image, to create an image that has been "trimmed" of excess pixels.

To crop an image, click the crop_check_box check box. Enter the start and end values for the row numbers, column numbers, slice numbers and frames numbers (if applicable) for the cropped image. You can set the default values (the full range as the original image) by clicking the set_defaults_button button. (You must set an input image before the Set Defaults button will bring up the defaults.)

Note: the valid range of values goes from 1 to the number of samples in each dimension. Entering a value outside this range will cause an error message to be displayed.

Filtering

You can apply one of several filtering operations to change the nature of the intensities of the image.

To filter an image, click the filter_check_box check box, and select the tab for the type of filter you want to apply. You can choose:

Resizing pixels

To resize the pixels of an image, click the resize_check_box check box.

There are two ways to specify how you want the image pixels to be resized:

When you have set up the resampling scheme, click on the resample_button button to do the resampling. If you have chosen to save the result to disk, then a File Chooser will pop up, prompting you to choose a file name for the new (re-sampled) image; otherwise, the result will be loaded into Jim.

Type of Interpolation

If the number of samples you specify is greater than the original in any dimension, or if the pixel size is smaller than the original, then the image must be interpolated to obtain the new intensity values.

interpolation_types

You can select from the four options:

Type of Sub-sampling

If the number of samples you specify is fewer than the original in any dimension, or if the pixel size is larger than the original, then the image must be sub-sampled to obtain the new intensity values.

sub_sample_types

You can select from the three options:
  • Nearest neighbour. The intensity of a pixel in the re-sampled image will be that of the pixel which is closest in the original image.
  • By averaging. The intensity of a pixel in the re-sampled image will contain a contribution from of all pixels of the original image that are contained within the new pixel, in proportion to the area contained.
  • Low-pass filtered. The original image is low-pass filtered with a filter width appropriate to the new pixel size, and then re-sampled using sinc interpolation.

    Padding

    Padding involves putting extra columns, rows, slices and frames in an image, to create an image that has a greater number of pixels than it had originally.

    To pad an image, click the pad_check_box check box. Enter the numbers of columns, rows, slices and frames (if applicable) for the padded image. Each value you enter should be at least as large as the number of samples in the original image (or, if you have performed cropping or resampling, in the result of these operations). You can set the default values (the same range as in the original image) by clicking the set_defaults_button button.

    Note: the image is padded as evenly as possible around the edges. For example suppose the image to be padded has 256 columns, and you specify that the padded image will have 261 columns. Three columns are added to the left hand side of the image, and two to the right to make up the difference in the number of columns.

    Flipping

    Use this to flip an image about one or more axes. Select the required flip(s) by clicking on the appropriate buttons:

    Rotating

    You can rotate an image in steps of 90 degrees, while keeping the same image planes.

    Note: to rotate an image by arbitrary angles, use the Multi-Planar Reconstruction tool.

    To rotate an image, click the rotate checkbox check box. Select the required rotation by clicking on the appropriate button:

    Reorienting

    Reorienting involves changing the imaging plane (for example, from axial to coronal).

    To reorient an image, click the reorient_check_box check box. Select the orientation required by clicking on the appropriate button in the New orientation panel.

    new_orientation

    Jim may be able to determine the orientation of the original image (which it needs in order to perform the reorientation correctly). If it cannot, you will see an error message; in this case, tell Jim the original orientation by selecting the set_manually_check_box check box and clicking on the appropriate button in the Current orientation panel.

    set_orientation_manually

    By default, Jim assumes that the ordering of the image slices follows the standard radiological convention (slice number increasing from right to left, from anterior to posterior, and from inferior to superior). If your image slices do not follow this convention, then the re-oriented image will also not follow convention. If this happens, and you see (for example) in your reoriented image that the anterior portion of the patient is towards the bottom of the screen, then click the slices_reversed_check_box check-box to tell Jim that your image slice order does not follow the standard radiological convention.
    Jim Home