<div dir="ltr">Some how I fixed this!!<br><br><br>Here is some details from the program<br><br><font size="4">with vtkDICOMImageReader:</font><br><span style="font-family: &#39;Times New Roman&#39;; font-size: 10pt; color: rgb(0, 0, 153);">Image spacing: 1.07422 1.07422 3 </span>
<p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 153);"><span style="font-family: &#39;Times New Roman&#39;; font-size: 10pt;">Image position: -275 -524 -122.441 </span></p><span style="color: rgb(0, 0, 153);">
</span><p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 153);"><span style="font-family: &#39;Times New Roman&#39;; font-size: 10pt;">Image Dims: 512 512 98 </span></p><span style="color: rgb(0, 0, 153);">
</span><p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 153);"><span style="font-family: &#39;Times New Roman&#39;; font-size: 10pt;">Image Extent: 0 511 0 511 0 97 </span></p><span style="color: rgb(0, 0, 153);">
</span><p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 153);"><span style="font-family: &#39;Times New Roman&#39;; font-size: 10pt;">Image Origin: 0 0 0 </span></p><span style="color: rgb(0, 0, 153);">
</span><p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 153);"><span style="font-family: &#39;Times New Roman&#39;; font-size: 10pt;">ImageOrient: 1 0 -1.22465e-16 0 1 0 </span></p><span style="color: rgb(0, 0, 153);">
</span><p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 153);"><span style="font-family: &#39;Times New Roman&#39;; font-size: 10pt;">Slice Thickness: 3 </span></p><span style="color: rgb(0, 0, 153);">
</span><p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 153);"><span style="font-family: &#39;Times New Roman&#39;; font-size: 10pt;">No.of slices: 98 <br></span></p><p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 153);">
<br><span style="font-family: &#39;Times New Roman&#39;; font-size: 10pt;"></span></p><p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 153);"><span style="font-family: &#39;Times New Roman&#39;; font-size: 10pt;"><font size="4"><span style="color: rgb(0, 0, 0);">with vtkGDCMImageReader:</span></font><br>
</span></p><span style="color: rgb(0, 0, 153);">
</span><p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 153);"><span style="font-family: &#39;Times New Roman&#39;; font-size: 10pt;">Dose grid scaling factor: 1.4e-05 </span></p><span style="color: rgb(0, 0, 153);">
</span><p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 153);"><span style="font-family: &#39;Times New Roman&#39;; font-size: 10pt;">Dose spacing: 2.5 2.5 3 </span></p><span style="color: rgb(0, 0, 153);">
</span><p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 153);"><span style="font-family: &#39;Times New Roman&#39;; font-size: 10pt;">Dose origin: -228.654 -99.2445 -122.441 //the actual value is </span><span style="font-family: &#39;Times New Roman&#39;; font-size: 10pt;">-228.654 <b>-419.2444</b> -122.44 <br>
</span></p><span style="color: rgb(0, 0, 153);">
</span><p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 153);"><span style="font-family: &#39;Times New Roman&#39;; font-size: 10pt;">Dose dims: 194 129 98 </span></p><br>from gdcm docs<br><br><dl class="user"><dt>
<b>&quot;DataOrigin:</b></dt><dd>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.&quot;</dd></dl>From these, I feel the vtkGDCMImageReader flips the image and recalculates the data origin.<br>And it also seems to flip the  X &amp; Y. When I set the position of dose actors as setPosition(ImagePositionPatientct[0],ImagePositionPatientdose[0] it exactly matches.<br>
<br>Does anyone have a beeter understanding of this?<br><br> <br><br><div class="gmail_quote">On Fri, Feb 25, 2011 at 3:12 PM, Mark Roden <span dir="ltr">&lt;<a href="mailto:mmroden@gmail.com">mmroden@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi Bill,<br>
<br>
My theory (which I can&#39;t verify without knowing the orientation<br>
vectors) has to do with how vtk handles orientation vectors in<br>
comparison to DICOM.<br>
<br>
DICOM specifies that patient position is the upper left corner, and<br>
then provides direction vectors for display that indicate how the<br>
image was acquired.  Z direction is handled as the dot product of<br>
direction cosines in another DICOM tag.<br>
<br>
So, for instance, in the x direction, the upper left coordinate can be<br>
-128, and then if the image is 256 pixels across with a spacing of 1,<br>
the extent in the x dimension should be (-128, 128).  The direction<br>
cosine is irrelevant, from the perspective of DICOM, of calculating<br>
the extent.  However, if the direction is -1, vtk changes the extent<br>
to (-384, -128).  If the direction cosines are just 1 or -1, flipping<br>
is straightforward.  However, for MR images, the direction cosines are<br>
almost guaranteed _not_ to be -1 or 1.<br>
<br>
This hasn&#39;t been an issue until people want to overlay images on one<br>
another, like RTDose/RTStruct on CT images.  RTStructs are contours<br>
represented by explicit coordinates using the DICOM definition of the<br>
pixel locations, so RT images are almost always in the wrong spot in<br>
VTK, and have to be flipped into the right position.<br>
<br>
I do not know how to solve this issue, and I do not know if this is<br>
the issue that Jothy is experiencing without knowing his direction<br>
cosines.  Is it a bug in the DICOM reader, in which case the DICOM<br>
reader should be explicitly setting the extent array instead of<br>
relying on the vtk interpretation?  Would that cause some problems<br>
with vtk then assuming that the direction cosines should create the<br>
extent array?<br>
<font color="#888888"><br>
Mark<br>
</font><div><div></div><div class="h5"><br>
On Thu, Feb 24, 2011 at 9:05 AM, Bill Lorensen &lt;<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>&gt; wrote:<br>
&gt; Maybe I missed something.<br>
&gt;<br>
&gt; Why can&#39;t you use the same GDCM reader for both sets of images?<br>
&gt;<br>
&gt;<br>
&gt; On Thu, Feb 24, 2011 at 9:50 AM, Jothy &lt;<a href="mailto:jothybasu@gmail.com">jothybasu@gmail.com</a>&gt; wrote:<br>
&gt;&gt; FrameOfReferenceUIDs do match. I think the problem is with the different<br>
&gt;&gt; readers used to read CT and RT dose.<br>
&gt;&gt;<br>
&gt;&gt; I will use ImagePositionPatient to register the coordinates.<br>
&gt;&gt;<br>
&gt;&gt; Thank you<br>
&gt;&gt;<br>
&gt;&gt; Jothy<br>
&gt;&gt;<br>
&gt;&gt; On Wed, Feb 23, 2011 at 6:04 PM, Scott Johnson &lt;<a href="mailto:Scott.Johnson@neuwave.com">Scott.Johnson@neuwave.com</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; If the FrameOfReferenceUIDs of the CT and the RT dose are the same, they<br>
&gt;&gt;&gt; both exist in the same coordinate system, if they don’t, you will have to<br>
&gt;&gt;&gt; register the dose to the CT somehow.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Because the resolution of the dose will generally be different than the CT<br>
&gt;&gt;&gt; a reasonable strategy is to loop through your CT voxels and use the position<br>
&gt;&gt;&gt; at the center of that voxel to sample into the RT Dose grid.  When you<br>
&gt;&gt;&gt; sample into the RT Dose you may need to interpolate the actual dose value.<br>
&gt;&gt;&gt; That dose value determines your shading.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; The other issue to be aware of is that the dose grid may not completely<br>
&gt;&gt;&gt; cover the CT image data.  This is probably why the origins are different for<br>
&gt;&gt;&gt; your data.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;                                 -- Scott<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; From: <a href="mailto:vtkusers-bounces@vtk.org">vtkusers-bounces@vtk.org</a> [mailto:<a href="mailto:vtkusers-bounces@vtk.org">vtkusers-bounces@vtk.org</a>] On Behalf<br>
&gt;&gt;&gt; Of Jothy<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Sent: Wednesday, February 23, 2011 11:38 AM<br>
&gt;&gt;&gt; To: gdcm-developers; VTK Mailing List; itk;<br>
&gt;&gt;&gt; <a href="mailto:python-medphys@googlegroups.com">python-medphys@googlegroups.com</a><br>
&gt;&gt;&gt; Subject: [vtkusers] Matching CT and RT dose coordinates<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Hi all,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I am trying to overlay an dose shade on a CT slice.I am using<br>
&gt;&gt;&gt; vtkDICOMImageReader to read the CT and vtkGDCMImageReader to display the<br>
&gt;&gt;&gt; dose shade.But I am having problem with the coordinates.How to relate the<br>
&gt;&gt;&gt; coordinates? For e.g: I  get ImagePositionPatient of CT image for central<br>
&gt;&gt;&gt; slice as [-275,-524,-128.25] and ImagePositionPatient for dose as<br>
&gt;&gt;&gt; [-228.65,-419.25,-122.5] adn their spacings are [1.074,1.074,3] and<br>
&gt;&gt;&gt; [2.52.5.2.5] respectively for CT and Rt dose.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; The image looks as in the attached figure.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Any hint<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Thanks<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Jothy<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;&gt;<br>
&gt;&gt; Visit other Kitware open-source projects at<br>
&gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt;<br>
&gt;&gt; Please keep messages on-topic and check the VTK FAQ at:<br>
&gt;&gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt;&gt;<br>
&gt;&gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
</div></div><div><div></div><div class="h5">&gt; ------------------------------------------------------------------------------<br>
&gt; Free Software Download: Index, Search &amp; Analyze Logs and other IT data in<br>
&gt; Real-Time with Splunk. Collect, index and harness all the fast moving IT data<br>
&gt; generated by your applications, servers and devices whether physical, virtual<br>
&gt; or in the cloud. Deliver compliance at lower cost and gain new business<br>
&gt; insights. <a href="http://p.sf.net/sfu/splunk-dev2dev" target="_blank">http://p.sf.net/sfu/splunk-dev2dev</a><br>
&gt; _______________________________________________<br>
&gt; Gdcm-developers mailing list<br>
&gt; <a href="mailto:Gdcm-developers@lists.sourceforge.net">Gdcm-developers@lists.sourceforge.net</a><br>
&gt; <a href="https://lists.sourceforge.net/lists/listinfo/gdcm-developers" target="_blank">https://lists.sourceforge.net/lists/listinfo/gdcm-developers</a><br>
&gt;<br>
</div></div></blockquote></div><br></div>