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:
of the main display frame. This brings up the Image Resampler tool:

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:

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
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.

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
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
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
check box, and select the tab for the type of filter you want to apply. You can choose:
- Sharpen

This applies a kernel-based sharpening filter which emphasises edges. The filter can be applied in either 2-D or 3-D and you can set the kernel size.
- Sobel

This applies a Sobel filter that calculates the image intensity gradient. You can calculate the gradient in the X (horizontal), Y (vertical) or Z (through-slice) direction, or you can calculate the magnitude of the gradient. The gradient calculation can be performed either in 2-D (using 2-D kernel filters) or in 3-D.
- Morphological operation

This applies a morphological operation to dilate, erode, open or close image features. The filter can be applied in either 2-D or 3-D and you can set the kernel size.
- Gaussian blur

This applies a kernel-based blurring filter to smooth images. The filter can be applied in either 2-D or 3-D and you can set the kernel size. A larger kernel size will lead to more blurring.
- Median

This applies a kernel-based median filter to smooth images. The filter can be applied in either 2-D or 3-D and you can set the kernel size. A larger kernel size will lead to more blurring. A median filter replaces the pixel value at the centre of the kernel with the value that is the median within the kernel.
- Patch Similarity

This applies a noise reduction filter that examines image patches near to a pixel to find patches that have a similar intensity pattern to the patch centred at the target pixel. The pixels at the centre of the most similar patches are then averaged (with a weighting that depends on how similar the patch is to the target) and the target pixel replaced by this average. The result is a reduction in the image noise but without the blurring associated with simple kernel filters like the Gaussian blur. However, examining the patches is computationally intensive, and the filtering takes a long time, especially when applied in 3-D.
You can set the degree of noise suppression using the slider, either as:
- The standard deviation (in image intensity units) of the noise.
- A percentage of the image intensity range (robustly excluding outliers).
Using the percentage of the image intensity range will give more consistent results when the image intensity range varies across images.
- Laplacian

This applies a kernel-based Laplacian filter to calculate the second spatial derivative to emphasise edges of an image. The filter can be applied in either 2-D or 3-D and you can set the kernel size.
- Colour image filter

This applies a pixel-by-pixel colour remapping, with the new red, green and blue colour components being calculated from the current red, green and blue colour components according to the formulas entered into the three text field. The current colour values are numbers between 0.0 and 1.0, and are referenced by the symbols "R", "G" and "B" in the formulas. For example to have the red component of the output image calculated as the average of the green and blue components of the input image, you could enter the formula "0.5*(G+B)" into the red component field. To set the blue colour component value to zero, you would enter "0" into the blue component field.
Calculated colour values should lie between 0.0 and 1.0, and are scaled by 255 in the output image to give colour gun values between 0 and 255. Values that result from application of the three formulas that lie outside this range are clipped. This image filter is only applicable to colour images.
Resizing pixels
To resize the pixels of an image, click the
check box.
There are two ways to specify how you want the image pixels to be resized:
- Specify the numbers of samples. You tell the Image Resampler how many rows, columns, slices and frames you want in the re-sampled image.

Enter the number of rows, columns, slices and frames (if applicable) for the re-sampled image. You can set the default values (the same number of samples as the original image) by clicking the
button. (You must set an input image before the Set Defaults button will bring up the defaults.)
- Specify the pixel sizes in each dimension of the image. You tell the Image Resampler what pixel sizes you want in the re-sampled image.
![]()
Enter the pixel sizes (in mm) and time between frames (in seconds, if applicable) for the re-sampled image. You can set the default values (the same pixel sizes as the original image) by clicking the
button. (You must set an input image before the Set Defaults button will bring up the defaults.)
When you have set up the resampling scheme, click on the
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.

You can select from the four options:
- Nearest neighbour. The intensity of a pixel in the re-sampled image will be the same as the intensity of the nearest pixel in the original image. This is quick, but does not improve the appearance of the interpolated image.
- Linear. Linear interpolation is used to calculate the pixel intensity in the re-sampled image. This is the default, and gives a good compromise between speed and quality of the interpolated image.
- Sinc. Sinc interpolation is used to calculate the pixel intensity in the re-sampled image. This gives the best results for MR images, but is relatively slow.
- Sinc in-plane, linear otherwise. Sinc interpolation is used in the row and column directions, but linear interpolation is used in all the other directions. This is useful for resampling multi-slice MR images (rather than 3D), where sinc interpolation in the slice-selection direction does not give an advantage over linear interpolation.
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.

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
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
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:
to left-right flip the image about a vertical axis as seen on screen.
to flip the image from top-to-bottom about a horizontal axis as seen on screen.
to reverse the slice order.
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
check box. Select the required rotation by clicking on the appropriate button:
to rotate the image by 90 degrees counter-clockwise.
to rotate the image by 90 degrees clockwise.
to rotate the image by 180 degrees.
Reorienting
Reorienting involves changing the imaging plane (for example, from axial to coronal).
To reorient an image, click the
check box. Select the orientation required by clicking on the appropriate button in the New orientation panel.

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
check box and clicking on the appropriate button in the Current orientation panel.

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
check-box to tell Jim that your image slice order does not follow the standard radiological convention.