Converting Raw Data into Images

The Raw Converter allows the conversion of raw binary data into one of the supported multi-slice image formats.

To convert images select Raw Data Converter ... from the File menu: File menu, raw converter

The Raw Converter window will now appear:

The Raw Converter Frame

The Raw Converter allows you to create one single-slice or multi-slice image from one or more input files. Each of the input files may contain pixel values for one or more slices of the output image.

First, select the input file(s) from which the pixel values will be extracted by pressing the select_files_button button. A file chooser will now pop up. To select more than one input file, follow the instructions in the file chooser description.

Next select the type of binary data in your input files. If you select the wrong type for your data, the resulting images will be unusable. Choose:

  • Byte for signed 8-bit integer data.
  • Ubyte for unsigned 8-bit integer data.
  • Short for signed 16-bit integer data.
  • UShort for unsigned 16-bit integer data.
  • Int for signed 32-bit integer data.
  • Uint for unsigned 32-bit integer data.
  • Long for signed 64-bit integer data.
  • RGB for red,green,blue 3×8-bit data.
  • BGR for blue,green,red 3×8-bit data.
  • Float for 32-bit floating point data.
  • Double for 64-bit floating point (double precision) data.

Next select the byte order for the input data, either:

  • Little Endian for data typically originating on a PC (MS Windows or Linux or Macs).
  • Big Endian for data typically originating on a Sun/SPARC or SGI workstation.

Note: the actual byte order depends not only on the type of computer, but also on the software it runs to produce the image data. If you're not sure of the binary format or byte order of your data, contact the person from whom the data originated, or the manufacturer of the equipment that produced the data (or just experiment with Jim).

If the pixel values do not start at the beginning of your binary input files, or if there is additional data between the data for individual slices, then enter the data offsets (in bytes) in the Data offset fields:

raw_data_offsets

In the example above, the data for the first slice of the image starts at an offset of 1024 bytes into the input files(s), and there are 512 bytes of non-image data between slices in the input file(s). If each file contains only one slice of image data, then the second offset value is ignored.

Now tell the Raw Converter how to combine the input data into images. Specify:

  • The number of columns and rows in the image. In this example the image has 256 rows and columns.

raw_rows_columns

The number of slices is detected automatically.

  • The pixel sizes, either by setting the field of view:

raw_fov

or the pixel sizes directly:

raw_pixel_sizes

In this example Jim is being told either that pixels are 0.96 mm square, or that the field of view is 250 mm square.

  • The slice thickness.

raw_slice_thickness

  • Any flipping of the data that needs to be performed if the output image is to follow radiological convention. This convention is:

  • Patient's right should appear to the left of the screen (axial or coronal sections) or be the first slice (sagittal sections).

  • Anterior should be towards the top of the screen (axial sections) to the left of the screen (sagittal sections) or be the first slice (coronal sections).
  • Inferior should be towards the bottom of the screen (coronal or sagittal sections) or be the first slice (axial sections).

Check the boxes in order to achieve the correct orientation of your image:

raw_flip_checks

Now choose the format of the image to be created. Select:

  • The file format to which you want to convert the images (NIFTI-1, NIFTI-2, AnalyzeTM, DICOM or UNC).
  • The type of pixels that you want in the output image. If you select "Auto", then Jim will choose the most appropriate pixel type. If you choose a pixel type that is incompatible with the sort of raw input data, then an error will appear. If you choose a pixel type that is not supported by the file format of the output image, then an error will also appear.
  • Specify the title of the image (not the file name). The title you supply will be truncated if it is too long for the output file format. Supplying a title is optional.
  • Finally tell Raw Converter what imaging plane your data is most like (Axial, Sagittal or Coronal). If you don't know, don't care, or there are various imaging planes in the data, leave this as "Unknown".

When ready, press the convert_button button to begin conversion of your raw data files.

Depending on whether your selection load_save, the converted image will either be loaded into Jim, or a file chooser will pop up for you to enter an file name for the new image.

Depending on the datatype you have selected for the output image, you may receive a pop-up message warning that the input data may need to be clipped to fit into the data range of the output image. For example, if you select Short as the input datatype, and UByte as the output pixel type, then you will see:

clip_or_cancel

Since short (16-bit) values range from -32768 to 32767, it is not possible to store these within the range of unsigned byte values (range: 0 to 255). If "Clip if necessary" is selected, the pixel values in the input data above 255 will be set to a value of 255, and those below 0 will be set to 0 in the output image.

Click the done_button button when you have finished with the Raw Converter.