[vtkusers] dicom series image orientation problem! request David for help!

David Gobbi david.gobbi at gmail.com
Tue Jun 5 09:01:34 EDT 2018


Where does info->patient_orientation come from?  Is it the cross product of
patient_row_orientation and patient_col_orientation?

The line "imgdata->DeepCopy(reslice->GetOutput());" looks like a mistake,
is it meant to be "imgdata->DeepCopy(imgchangeinfo->GetOutput());"?  And
where does the "imgdata" object come from?  Note that it is only safe to
DeepCopy into a data object that you create yourself, it isn't safe to
DeepCopy into an object that is the output of a VTK algorithm.

Also, the output of vtkTransformFilter is a vtkStructuredGrid, not a
vtkImageData, so it seems like an unusual filter to use in a VTK image
display pipeline.

For the problem with multi-frame files, my guess is that you depend on
proper sorting of the DICOM files in order to properly reconstruct the
volume, and file sorting doesn't work if there is only one file.  Instead,
it is necessary to sort the frames, but how to do this depends on what kind
of multi-frame file you have (e.g. NM vs enhanced MR/CT/US).

If you're curious, you can see my own DICOM file/frame sorting code here:
https://github.com/dgobbi/vtk-dicom/blob/master/Source/vtkDICOMSliceSorter.cxx#L414

 - David



On Tue, Jun 5, 2018 at 2:30 AM, scofield zhu <scofieldzhu.zcg at gmail.com>
wrote:

> hi david,
>      I use vtkGDCMImageReader(gdcm2.8.5) to read dicom serires image, and
> SetFileLowerLeftOn() called too. after success reading, the process image
> codes as following:
> ____________________________________________________________
> _________________
>        Point3 data_origin = imgdata->GetOrigin();
>     Point3 dataorigin = info->origin;
>     Point3 patient_position = info->patient_position;
>
>     //here: i am sure:data_origin is equal with both dataorigin and
> patient_position
>
>     Vec3 row_orient = info->patient_row_orientation;
>     Vec3 col_orient = info->patient_col_orientation;
>     Vec3 slice_orient = info->patient_orientation;
>
>     vtkMatrix4x4* matrix = vtkMatrix4x4::New();
>     matrix->Identity();
>     matrix->SetElement(0, 0, row_orient[0]);
>     matrix->SetElement(0, 1, row_orient[1]);
>     matrix->SetElement(0, 2, row_orient[2]);
>     matrix->SetElement(1, 0, col_orient[0]);
>     matrix->SetElement(1, 1, col_orient[1]);
>     matrix->SetElement(1, 2, col_orient[2]);
>     matrix->SetElement(2, 0, slice_orient[0]);
>     matrix->SetElement(2, 1, slice_orient[1]);
>     matrix->SetElement(2, 2, slice_orient[2]);
>
>     vtkMatrix4x4* inverse_matrix = vtkMatrix4x4::New();
>     matrix->Invert(matrix, inverse_matrix);
>     double new_origin[4] = {0.0};
>     new_origin[3] = 1.0;
>     inverse_matrix->MultiplyPoint(data_origin, new_origin);
>     inverse_matrix->Delete();
>
>     vtkImageChangeInformation* imgchangeinfo = vtkImageChangeInformation::
> New();
>     imgchangeinfo->SetOutputOrigin(new_origin[0], new_origin[1],
> new_origin[2]);
>     imgchangeinfo->SetInputData(imgdata);
>     imgchangeinfo->Update();
>     imgdata->DeepCopy(reslice->GetOutput());
>     imgchangeinfo->Delete();
>
>     vtkTransformFilter* transform_filter = vtkTransformFilter::New();
>     vtkTransform* patient_transform = vtkTransform::New();
>     patient_transform->SetMatrix(matrix);
>     transform_filter->SetTransform(patient_transform);
>     transform_filter->SetInputData(imgdata);
>     transform_filter->Update();
>     imgdata->DeepCopy(transform_filter->GetOutputDataObject(0));
>     transform_filter->Delete();
>     patient_transform->Delete();
>     matrix->Delete();
>
> __________________________________________________________________________
>
>     it works ok in some dicom series image, but not working for some
> series image especially single dcm file with multi-frame.
>
>     what's wrong in my code? please help me ! thanks a lot!
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20180605/5b35e7be/attachment.html>


More information about the vtkusers mailing list