Internal:Preprocess Medical Images

From crtc.cs.odu.edu
Jump to navigation Jump to search

Author: Eleni Adam (originally in /RC/group/RC_NIKOS/Eleni/Manuals)

PROCEDURE OF IMAGE PREPROCESSING

ORIGINAL DATA (file names):

preop: Preoperative image (a.k.a. Moving image, Floating image)

intraop: Intraoperative image (a.k.a. Fixed image, Reference image)

Patient: Segmentation of the tumor

intraop_to_preop: Rigid transform that maps the intraoperative to the preoperative image

  • Possible file extensions:
    • For images and deformation field: .nii , .nii.gz , .nrrd , .nrrd.gz, .mha
    • For transforms: .h5
  • If the image is given with an extension of .nrrd and the user wants to change it to .nii.gz:
    • Open Slicer and save the image in the preferred format.
  • If T1 images are given:
    • Open Slicer, Press (File->)DICOM, then Import, select the folder (eg. pre folder containing the preoperative image) and then Load the DICOM data. then save the image in the preferred format.

TOOLS / PARAMETERS:

1 BET (Brain Extraction Tool - FSL):

Used in order to extract the skull from the preoperative and the intraoperative image and to acquire the mask of the preoperative image.

Input: preop Fractional intensity threshold: 0.5 Output: preop_brain, preop_brain_mask

Input: intraop Fractional intensity threshold: 0.5 Output: intraop_brain

NOTES regarding STEP 1:

  • Other tools that can be used to implement STEP 1:

Brain extraction tools that are available in the 3D SLICER tool as plugins,

(they can be found and installed from Slicer ExtensionManager, using the latest nightly build package of Slicer).

ROBEX Brain Extraction: https://www.slicer.org/wiki/Documentation/Nightly/Modules/ROBEXBrainExtraction

Swiss Skull Stripper: https://www.slicer.org/wiki/Documentation/Nightly/Modules/SwissSkullStripper

Skull Stripper: https://www.slicer.org/wiki/Documentation/Nightly/Modules/SkullStripper

  • Semi-automatic removal of the resected area:

(If the extraction tool used in the intraoperative image has not set the recected area to background (zero value) due to a possibly existing fluid, then it can be semi-automatically removed by following these steps)

Use of the tool Slicer/Simple Region Growing Segmentation: Placing seeds (fiducials) at the aforementioned area, applying the tool and saving the output into a new file. Use of the CombineImages code: Enter the intraoperative image and the newly created label image (that defines the resected area).

In the source code (that can be found in /RC/group/RC_NIKOS/Eleni/code/source/CombineImages/): Change the PixelType according to the image type [which can be found by opening the image on Slicer/Volumes/Volume Information/Scalar Type]

In lines 111-122 of the source code where the iteration loop is located: Change the label of the second image accordingly [which can be found by opening the image on Slicer, and placing the mouse cursor on top of each region, i.e. background (most common label is 0), mask (could be 1), tumor (could be 2)]

In the iteration (loop), the final label values could be changed accordingly in order to modify the image only in the resected area, which should be set to zero. So, at the pixels where the second image (defining the resected area) has a label (other than zero - exact value is found with the use of the mouse cursor as stated above), these pixels of the intraoperative image should be now changed to zero (background label).


2) SLICER/Transforms/Invert:

Used to produce the inverse of the given transform in order to map the preoperative to the intraoperative image.

Input: intraop_to_preop Output: INVintraop_to_preop

NOTE regarding STEP 2 necessity:

If the transform was already mapping the intraoperative to the preoperative there would be no need to invert it.


3) SLICER/Transforms:

Used to rigid register with the produced INVintraop_to_preop transform the preoperative, the mask and the segmentation of the tumor.

Input: INVintraop_to_preop, preop_brain Output: Rpreop_brain

Input: INVintraop_to_preop, preop_brain_mask Output: Rpreop_brain_mask

Input: INVintraop_to_preop, Patient Output: RPatient

NOTE regarding STEP 3 to Rigid Register the image:

If the transfomation matrix is given, the above procedure of STEPS 2 and 3 takes place. Otherwise, the Slicer tool General Registration is used to rigid register the image. Selected registration phase: Rigid Selected interpolation mode: Linear for the preoperative (preop_brain) and Nearest Neighbor for the mask (preop_brain_mask) and the segmentation of the tumor (Patient).


4) SLICER/Resample Scalar/Vector/DWI Volume:

Used to resample (if needed) the rigid registered preoperative, mask and segmentation of the tumor according to the intraoperative.

Reference Volume: intraop_brain Input: Rpreop_brain Output: ResRpreop_brain interpolation: linear

Reference Volume: intraop_brain Input: Rpreop_brain_mask Output: ResRpreop_brain_mask interpolation: nn

Reference Volume: intraop_brain Input: RPatient Output: ResRPatient interpolation: nn

NOTE regarding STEP 4 to resample the image:

If the General Registration tool was used for the rigid registration, then there is no need to execute STEP 4, since the images are already resampled.


5) Code to combine (CombineImages) the resampled mask and the segmentation of the tumor:

Input: ResRpreop_brain_mask, ResRPatient Output: ResRcombined

NOTE regarding STEP 5 to combine the images:

In the source code (that can be found in /RC/group/RC_NIKOS/Eleni/code/source/CombineImages/): Change the PixelType according to the image type [which can be found by opening the image on Slicer/Volumes/Volume Information/Scalar Type]

In lines 111-122 of the source code where the iteration loop is located: Change the labels of the images accordingly [which can be found by opening the image on Slicer, and placing the mouse cursor on top of each region, i.e. background (most common label is 0), mask (could be 1), tumor (could be 2)]

If the two images to be combined have the same label, in the iteration (loop), the final label values could be changed accordingly in order to modify the output label setting the preferred value.


6) Code to orient (IdentityOrientation) the images according to the Identity matrix:

The resulting image differences can be seen in Slicer/Volumes/Volume Information/IJK to RAS direction matrix that as a result it will be set to "identity" (Slicer's orientation) matrix.

Input: intraop_brain Output: Orintraop_brain

Input: ResRpreop_brain Output: OrResRpreop_brain

Input: ResRcombined Output: OrResRcombined

NOTE regarding STEP 6 to orient the images:

In the source code (that can be found in /RC/group/RC_NIKOS/Eleni/code/source/IdentityOrientation/): Change the PixelType according to the image type [which can be found by opening the image on Slicer/Volumes/Volume Information/Scalar Type]