[vtk-developers] Reg:Oblique MPR

David Gobbi david.gobbi at gmail.com
Mon Mar 6 09:28:17 EST 2017


I'll add that you can use SetResliceAxes() and SetResliceTransform()
together.  Use the former to define a set of axes, and use the latter to
apply a rotation.

 - David

On Mon, Mar 6, 2017 at 7:05 AM, Sankhesh Jhaveri <
sankhesh.jhaveri at kitware.com> wrote:

> 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
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20170306/bd44a107/attachment.html>


More information about the vtk-developers mailing list