[vtk-developers] Reg:Oblique MPR

Sankhesh Jhaveri sankhesh.jhaveri at kitware.com
Mon Mar 6 09:05:45 EST 2017


Hi Pandiyan,

You should be able to use the same class (vtkImageReslice) to generate
oblique MPR. Just use the appropriate reslice axes direction cosines and
origin.

Hope that helps.

Sankhesh
​

On Mon, Mar 6, 2017 at 5:40 AM Pandia raja <pandia005 at gmail.com> wrote:

> Hi,
>
> Could you please help me to generate Oblique MPR. I can able to generate
> Orthogonal MPR using the below code.My requirement is based on the angle
> seletion I need to generate sagittal and coronal images,
>
>
> dicomImageReader.SetDirectoryName ( dicomImagePath );
> dicomImageReader.Update ();
> xyminmax = dicomImageReader.GetOutput ().GetExtent ();
> xMin = xyminmax[0];
> xMax = xyminmax[1];
> yMin = xyminmax[2];
> yMax = xyminmax[3];
> zMin = xyminmax[4];
> zMax = xyminmax[5];
>
> spacing = dicomImageReader.GetOutput ().GetSpacing ();
> sx = spacing[0];
> sy = spacing[1];
> sz = spacing[2];
>
> origin = dicomImageReader.GetOutput ().GetOrigin ();
> ox = origin[0];
> oy = origin[1];
> oz = origin[2];
> //Display mpr image
> double cx = (ox + (0.5 * (xMax - xMin)) * sx);
> double cy = (oy + (0.5 * (yMax - yMin)) * sy);
> double cz = (oy + (0.5 * (zMax - zMin)) * sz);
>
> double[] axialElements = { 1, 0, 0, cx, 0, 1, 0, cy, 0, 0, 1, cz, 0, 0, 0,
> 1 };
> double[] coronalElements = { 1, 0, 0, cx, 0, 0, 1, cy, 0, -1, 0, cz, 0, 0,
> 0, 1 };
> double[] sagittalElements = { 0, 0, -1, cx, -1, 0, 0, cy, 0, -1, 0, cz, 0,
> 0, 0, 1 };
>
> // For display the Axial Slice...
> // Set the slice orientation...
> vtkMatrix4x4 axialResliceAxes = new vtkMatrix4x4();
> axialResliceAxes.DeepCopy(axialElements);
>
> // Extract a slice in the desired orientation...
> axialReslice = new vtkImageReslice();
> //axialReslice.SetSlabNumberOfSlices ( 1 );
> axialReslice.SetInputConnection(dicomImageReader.GetOutputPort());
> axialReslice.SetOutputDimensionality(2);
> axialReslice.SetResliceAxes(axialResliceAxes);
> axialReslice.SetInterpolationModeToLinear();
> axialReslice.SetResliceAxes(axialResliceAxes);
>
> // For display the Coronal Slice...
> // Set the slice orientation...
> vtkMatrix4x4 coronalResliceAxes = new vtkMatrix4x4();
> coronalResliceAxes.DeepCopy(coronalElements);
>
> // Extract a slice in the desired orientation...
> coronalReslice = new vtkImageReslice();
> coronalReslice.SetInputConnection(dicomImageReader.GetOutputPort());
> coronalReslice.SetOutputDimensionality(2);
> coronalReslice.SetResliceAxes(coronalResliceAxes);
> coronalReslice.SetInterpolationModeToLinear();
> coronalReslice.SetResliceAxes(coronalResliceAxes);
>
> // For display the Sagittal Slice...
> // Set the slice orientation...
> vtkMatrix4x4 sagittalResliceAxes = new vtkMatrix4x4();
> sagittalResliceAxes.DeepCopy(sagittalElements);
>
> // Extract a slice in the desired orientation
> sagittalReslice = new vtkImageReslice();
> sagittalReslice.SetInputConnection(dicomImageReader.GetOutputPort());
> sagittalReslice.SetOutputDimensionality(2);
> sagittalReslice.SetResliceAxes(sagittalResliceAxes);
> sagittalReslice.SetInterpolationModeToLinear();
> sagittalReslice.SetResliceAxes(sagittalResliceAxes);
> dicomImageReader.Delete ();
>
> Thanks,
> Pandiyan
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtk-developers
>
> --
Sankhesh Jhaveri *Sr. Research & Development Engineer* | Kitware
<http://www.kitware.com/> | (518) 881-4417
​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20170306/0a14331d/attachment-0001.html>


More information about the vtk-developers mailing list