[vtkusers] [Gdcm2] Matching CT and RT dose coordinates

Jothy jothybasu at gmail.com
Fri Feb 25 10:45:41 EST 2011


Some how I fixed this!!


Here is some details from the program

with vtkDICOMImageReader:
Image spacing: 1.07422 1.07422 3

Image position: -275 -524 -122.441

Image Dims: 512 512 98

Image Extent: 0 511 0 511 0 97

Image Origin: 0 0 0

ImageOrient: 1 0 -1.22465e-16 0 1 0

Slice Thickness: 3

No.of slices: 98


with vtkGDCMImageReader:

Dose grid scaling factor: 1.4e-05

Dose spacing: 2.5 2.5 3

Dose origin: -228.654 -99.2445 -122.441 //the actual value is -228.654 *
-419.2444* -122.44

Dose dims: 194 129 98

from gdcm docs

*"DataOrigin:*When the reader is instanciated with FileLowerLeftOn the
DataOrigin and Image Position (Patient) are identical. But when
FileLowerLeft is Off, we have to reorder the Y-line of the image, and thus
the DataOrigin is then translated to the other side of the image."From
these, I feel the vtkGDCMImageReader flips the image and recalculates the
data origin.
And it also seems to flip the  X & Y. When I set the position of dose actors
as setPosition(ImagePositionPatientct[0],ImagePositionPatientdose[0] it
exactly matches.

Does anyone have a beeter understanding of this?



On Fri, Feb 25, 2011 at 3:12 PM, Mark Roden <mmroden at gmail.com> wrote:

> Hi Bill,
>
> My theory (which I can't verify without knowing the orientation
> vectors) has to do with how vtk handles orientation vectors in
> comparison to DICOM.
>
> DICOM specifies that patient position is the upper left corner, and
> then provides direction vectors for display that indicate how the
> image was acquired.  Z direction is handled as the dot product of
> direction cosines in another DICOM tag.
>
> So, for instance, in the x direction, the upper left coordinate can be
> -128, and then if the image is 256 pixels across with a spacing of 1,
> the extent in the x dimension should be (-128, 128).  The direction
> cosine is irrelevant, from the perspective of DICOM, of calculating
> the extent.  However, if the direction is -1, vtk changes the extent
> to (-384, -128).  If the direction cosines are just 1 or -1, flipping
> is straightforward.  However, for MR images, the direction cosines are
> almost guaranteed _not_ to be -1 or 1.
>
> This hasn't been an issue until people want to overlay images on one
> another, like RTDose/RTStruct on CT images.  RTStructs are contours
> represented by explicit coordinates using the DICOM definition of the
> pixel locations, so RT images are almost always in the wrong spot in
> VTK, and have to be flipped into the right position.
>
> I do not know how to solve this issue, and I do not know if this is
> the issue that Jothy is experiencing without knowing his direction
> cosines.  Is it a bug in the DICOM reader, in which case the DICOM
> reader should be explicitly setting the extent array instead of
> relying on the vtk interpretation?  Would that cause some problems
> with vtk then assuming that the direction cosines should create the
> extent array?
>
> Mark
>
> On Thu, Feb 24, 2011 at 9:05 AM, Bill Lorensen <bill.lorensen at gmail.com>
> wrote:
> > Maybe I missed something.
> >
> > Why can't you use the same GDCM reader for both sets of images?
> >
> >
> > On Thu, Feb 24, 2011 at 9:50 AM, Jothy <jothybasu at gmail.com> wrote:
> >> FrameOfReferenceUIDs do match. I think the problem is with the different
> >> readers used to read CT and RT dose.
> >>
> >> I will use ImagePositionPatient to register the coordinates.
> >>
> >> Thank you
> >>
> >> Jothy
> >>
> >> On Wed, Feb 23, 2011 at 6:04 PM, Scott Johnson <
> Scott.Johnson at neuwave.com>
> >> wrote:
> >>>
> >>> If the FrameOfReferenceUIDs of the CT and the RT dose are the same,
> they
> >>> both exist in the same coordinate system, if they don’t, you will have
> to
> >>> register the dose to the CT somehow.
> >>>
> >>>
> >>>
> >>> Because the resolution of the dose will generally be different than the
> CT
> >>> a reasonable strategy is to loop through your CT voxels and use the
> position
> >>> at the center of that voxel to sample into the RT Dose grid.  When you
> >>> sample into the RT Dose you may need to interpolate the actual dose
> value.
> >>> That dose value determines your shading.
> >>>
> >>>
> >>>
> >>> The other issue to be aware of is that the dose grid may not completely
> >>> cover the CT image data.  This is probably why the origins are
> different for
> >>> your data.
> >>>
> >>>
> >>>
> >>>                                 -- Scott
> >>>
> >>>
> >>>
> >>> From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On
> Behalf
> >>> Of Jothy
> >>>
> >>> Sent: Wednesday, February 23, 2011 11:38 AM
> >>> To: gdcm-developers; VTK Mailing List; itk;
> >>> python-medphys at googlegroups.com
> >>> Subject: [vtkusers] Matching CT and RT dose coordinates
> >>>
> >>>
> >>>
> >>> Hi all,
> >>>
> >>> I am trying to overlay an dose shade on a CT slice.I am using
> >>> vtkDICOMImageReader to read the CT and vtkGDCMImageReader to display
> the
> >>> dose shade.But I am having problem with the coordinates.How to relate
> the
> >>> coordinates? For e.g: I  get ImagePositionPatient of CT image for
> central
> >>> slice as [-275,-524,-128.25] and ImagePositionPatient for dose as
> >>> [-228.65,-419.25,-122.5] adn their spacings are [1.074,1.074,3] and
> >>> [2.52.5.2.5] respectively for CT and Rt dose.
> >>>
> >>> The image looks as in the attached figure.
> >>>
> >>> Any hint
> >>>
> >>> Thanks
> >>>
> >>> Jothy
> >>
> >> _______________________________________________
> >> Powered by www.kitware.com
> >>
> >> Visit other Kitware open-source projects at
> >> http://www.kitware.com/opensource/opensource.html
> >>
> >> Please keep messages on-topic and check the VTK FAQ at:
> >> http://www.vtk.org/Wiki/VTK_FAQ
> >>
> >> Follow this link to subscribe/unsubscribe:
> >> http://www.vtk.org/mailman/listinfo/vtkusers
> >>
> >>
> >
> >
> ------------------------------------------------------------------------------
> > Free Software Download: Index, Search & Analyze Logs and other IT data in
> > Real-Time with Splunk. Collect, index and harness all the fast moving IT
> data
> > generated by your applications, servers and devices whether physical,
> virtual
> > or in the cloud. Deliver compliance at lower cost and gain new business
> > insights. http://p.sf.net/sfu/splunk-dev2dev
> > _______________________________________________
> > Gdcm-developers mailing list
> > Gdcm-developers at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gdcm-developers
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110225/86f652a9/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Dose.JPG
Type: image/jpeg
Size: 10552 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110225/86f652a9/attachment.jpeg>


More information about the vtkusers mailing list