Difference between revisions of "3D Reslicing using COMKAT image tool (basic)"

From COMKAT wiki
Jump to navigation Jump to search
Line 11: Line 11:
 
----
 
----
 
====Approach I.====
 
====Approach I.====
=====Load a file using COMKAT image tool and use the functions to translate and rotate the image volume as you desire. =====
+
Load a file using COMKAT image tool and use the functions to translate and rotate the image volume as you desire.  
  
 
   ivd = ImageVolumeData();
 
   ivd = ImageVolumeData();
  
=====Use read data to ivd,  e.g. read_DICOM(.)=====
+
 
 +
Use read data to ivd,  e.g. read_DICOM(.)
  
 
   ivd = read_DICOM(ivd, pathName, fileName); % load volume into an instance of IVD object;
 
   ivd = read_DICOM(ivd, pathName, fileName); % load volume into an instance of IVD object;
  
=====Create a list of indicies of all pixels in slice that we are creating=====
+
 
 +
Create a list of indicies of all pixels in slice that we are creating
  
 
   [i, j] = meshgrid(0 : Nc-1, 0 : Nr-1);
 
   [i, j] = meshgrid(0 : Nc-1, 0 : Nr-1);
 
     ij = [c(:)’ ; r(:)’];  % make matrix, each column corresponding to a single pixel in the slice we are creating
 
     ij = [c(:)’ ; r(:)’];  % make matrix, each column corresponding to a single pixel in the slice we are creating
  
=====(set up coordinate transform for desired slice) ref p 275=====
+
(set up coordinate transform for desired slice) ref p 275
 +
 
 +
  M = ( Insert the method for generate the transformation );
  
  M = (Insert the method for generate the transformation);
 
  
 
User specifies this based on desired pixel spacing (aka zoom), position (location), orientation
 
User specifies this based on desired pixel spacing (aka zoom), position (location), orientation
Calculate physical (mm) location of each pixel in the desired slice
+
Calculate physical (mm) location of each pixel in the desired slice
  
 
   xyz = M * ij;
 
   xyz = M * ij;
Line 36: Line 39:
 
this documents physical location voxels in the volume
 
this documents physical location voxels in the volume
  
   Mhat = ( transform for the stored volume)
+
   Mhat = ( transform for the stored volume )
 +
 
 +
 
 +
Calculate voxe indcies into the volume corresponding to xyz physical location
 +
 
 +
  uvw =  ( Insert the method for calculating voxel indices );.
  
Load a file using COMKAT image tool and use the functions to translate and rotate the image volume as you desire.
 
  
  ivd = ImageVolumeData();
+
Use sliceVolume(.) to interpolate the results
  
Load a file using COMKAT image tool and use the functions to translate and rotate the image volume as you desire.
+
  slice = sliceVolume(idv, v, u, w, backgroundPixelValue, ‘linear);
  
  ivd = ImageVolumeData();
 
  
 +
Display slice
  
====Create an empty imageVolumeData object====
+
  Figure, imagesc(slice); axis image % isotropic
Send the GUI handles of COMKAT image tool to MATLAB workspace.
 

Revision as of 20:03, 7 August 2012

Reslicing 3D image volume using COMKAT image tool (basic)

Overview

Reslicing a 3D (or 3D vs time) image dataset can be accomplished using the COMKAT image tool and sliceVolume(). This example explains how to create image slices from a volume in at a position, plane orientation, and magnification. The approach is to load the image volume dataset into an instance if an ImageVolumeData (abbreviated IVD) object and to use the sliceVolume() method.

Background

sliceVolume() is a mex-file written in c with an interface to MATLAB that makes the operation particularly efficient. COMKATImageTool uses sliceVolume() and you can use it too.


Approach I.

Load a file using COMKAT image tool and use the functions to translate and rotate the image volume as you desire.

  ivd = ImageVolumeData();


Use read data to ivd, e.g. read_DICOM(.)

  ivd = read_DICOM(ivd, pathName, fileName); % load volume into an instance of IVD object;


Create a list of indicies of all pixels in slice that we are creating

  [i, j] = meshgrid(0 : Nc-1, 0 : Nr-1);
   ij = [c(:)’ ; r(:)’];  % make matrix, each column corresponding to a single pixel in the slice we are creating

(set up coordinate transform for desired slice) ref p 275

  M = ( Insert the method for generate the transformation );


User specifies this based on desired pixel spacing (aka zoom), position (location), orientation

Calculate physical (mm) location of each pixel in the desired slice
  xyz = M * ij;


this documents physical location voxels in the volume

  Mhat = ( transform for the stored volume )


Calculate voxe indcies into the volume corresponding to xyz physical location

  uvw =  ( Insert the method for calculating voxel indices );.


Use sliceVolume(.) to interpolate the results

  slice = sliceVolume(idv, v, u, w, backgroundPixelValue, ‘linear);


Display slice

  Figure, imagesc(slice); axis image % isotropic