Hi, David,<br><br>Thanks. I will try it.<br><br>Also thanks for the great vtk-dicom component again.<br><br>Liu Peng<br><div><br><br></div>
 <span>
 </span>
<br>      在2017-08-30,"David Gobbi" <david.gobbi@gmail.com> 写道:
        <blockquote id="isReplyContent" style="padding-left:1ex; margin: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
        -----原始邮件-----<br>
        <b>发件人:</b>"David Gobbi" <david.gobbi@gmail.com> <br>
        <b>发送时间:</b>2017年08月30日 星期三<br>
        <b>收件人:</b>"Liu_tj" <tjlp@netease.com><br>
        <b>抄送:</b>"vtkusers" <vtkusers@vtk.org><br>
        <b>主题:</b>Re: Re: Re: Re: Re: What ditermines whether the slice order should be reversed?<br>
<br><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Aug 29, 2017 at 6:05 PM, Liu_tj <span dir="ltr"><<a href="mailto:tjlp@netease.com" target="_blank">tjlp@netease.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,David,<br><br>2 questions come up.<br><br>1. If I call reader-><wbr>SetMemoryRowOrderToFileNative(<wbr>) before update() method, do I still need to use vtkDICOMToRAS?<br></wbr></wbr></blockquote><div><br></div><div>Yes, if you are using vtkImageViewer (or vtkImageViewer2).  If you do not use vtkDICOMToRAS, then vtkImageViewer will show the image upside-down.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">2. If I update to the latest vtk-dicom version, do I still need to use reader-><wbr>SetMemoryRowOrderToFileNative(<wbr>) and vtkDICOMToRAS?</wbr></wbr></blockquote><div><br></div><div>No.  Again, I'm assuming that you are using vtkImageViewer2.</div><div><br></div><div> - David</div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">     在2017-08-29,"David Gobbi" <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> 写道:
        </span><blockquote id="m_5567654153334962732isReplyContent" style="padding-left:1ex;margin:0px 0px 0px 0.8ex;BORDER-LEFT:#ccc 1px solid"><span class="">
        -----原始邮件-----<br>
        <b>发件人:</b>"David Gobbi" <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> <br>
        <b>发送时间:</b>2017年08月29日 星期二<br>
        <b>收件人:</b>"Liu_tj" <<a href="mailto:tjlp@netease.com" target="_blank">tjlp@netease.com</a>><br>
        <b>抄送:</b>"vtkusers" <<a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a>><br>
        </span><b>主题:</b>Re: Re: Re: Re: What ditermines whether the slice order should be reversed?<div><div class="h5"><br>
<br><div dir="ltr">Hi Liu Peng,<div><br></div><div>If you apply vtkImageFlip to the image, then the matrix returned by reader->GetPatientMatrix() will not work with the image.  I recommend that, at the very least, you try doing the following instead:</div><div><br></div><div>1) use reader-><wbr>SetMemoryRowOrderToFileNative(<wbr>), and</wbr></wbr></div><div>2) try using vtkDICOMToRAS instead of vtkImageFlip:</div><div> <a href="https://github.com/dgobbi/vtk-dicom/blob/master/Source/vtkDICOMToRAS.h" style="white-space:pre-wrap" target="_blank">https://github.com/dgobbi/<wbr>vtk-dicom/blob/master/Source/<wbr>vtkDICOMToRAS.h</wbr></wbr></a></div><div><div class="gmail_extra"><br></div><div class="gmail_extra">Also, if possible, update to the latest version of vtk-dicom.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Cheers,</div><div class="gmail_extra"> - David</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 29, 2017 at 1:58 AM, Liu_tj <span dir="ltr"><<a href="mailto:tjlp@netease.com" target="_blank">tjlp@netease.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi, David,<br><br>Actually in my current code I use vtkImageFlip to flip the image data to solve the slice display orientation issue on coronal and saggital view as follow:<span class="m_5567654153334962732gmail-"><br><br>        vtkDICOMReader* reader = vtkDICOMReader::New();<br></span>        reader->SetFileNames(vtkDICOMF<wbr>ilePaths);<br>        reader->Update();<br>        vtkImageFlip* flip = vtkImageFlip::New();<br>        flip->SetInputConnection(reade<wbr>r->GetOutputPort());<br>        flip->SetFilteredAxis(2);<br>        flip->Update();<br>        vtkImageData* imageData = flip->GetOutput();<br><div><br></div><div>Thanks</div><div>Liu Peng<br></div><span class="m_5567654153334962732gmail-">
 <span>
 </span>
<br>      在2017-08-29,"David Gobbi" <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> 写道:
        </span><blockquote id="m_5567654153334962732gmail-m_815751471093880078isReplyContent" style="padding-left:1ex;margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204)"><span class="m_5567654153334962732gmail-">
        -----原始邮件-----<br>
        <b>发件人:</b>"David Gobbi" <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> <br>
        </span><b>发送时间:</b>2017年08月29日 星期二<span class="m_5567654153334962732gmail-"><br>
        <b>收件人:</b>"Liu_tj" <<a href="mailto:tjlp@netease.com" target="_blank">tjlp@netease.com</a>><br>
        <b>抄送:</b>"vtkusers" <<a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a>><br>
        </span><b>主题:</b>Re: Re: Re: What ditermines whether the slice order should be reversed?<div><div class="m_5567654153334962732gmail-h5"><br>
<br><div dir="ltr"><div>Hi Liu Peng,</div><div><br></div><div>For vtk-dicom, that would actually be version 0.7.1 (the current version is 0.8.5).</div><div><br></div><div>It is possible that you have run into this bug, which was fixed in 0.8.3:</div><div><a href="https://github.com/dgobbi/vtk-dicom/issues/132" target="_blank">https://github.com/dgobbi/vtk-<wbr>dicom/issues/132</wbr></a><br></div><div>The work-around for the bug is <span style="font-size:12.8px">reader->SetMemoryRowOrderTo<wbr>FileNative().  </wbr></span><span style="font-size:12.8px">See here for more info:</span></div><div><span style="font-size:12.8px"><a href="http://dgobbi.github.io/vtk-dicom/doc/api/image_orientation.html" target="_blank">http://dgobbi.github.io/vtk-di<wbr>com/doc/api/image_orientation.<wbr>html</wbr></wbr></a></span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Unfortunately, calling SetMemoryRowOrderToFileNative(<wbr>) doesn't work very well with vtkImageViewer or vtkImageViewer2, since these "viewer" classes insist on images that are in "bottom-to-top" order (DICOM images are natively in top-to-bottom order).  However, if you use vtkImageActor or vtkImageSlice to display your images, then you can set the camera so that "up" is in the correct direction.</wbr></span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">The vtkDICOMReader uses </span><span style="font-size:12.8px">ImageOrientationPatient (0020,0037) and ImagePositionPatient (0020,0032) to put the slices in order.  These attributes are more reliable and more precise than PatientPosition (0018,5100).</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Cheers,</span></div><div><span style="font-size:12.8px"> - David</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 28, 2017 at 7:03 PM, Liu_tj <span dir="ltr"><<a href="mailto:tjlp@netease.com" target="_blank">tjlp@netease.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi, David,<br><br>I forgot to mention the verison. The VTK and vtk-DICOM version are both 7.1<span class="m_5567654153334962732gmail-m_815751471093880078gmail-"><br><div><br>Thanks</div><div>Liu Peng<br></div>
 <span>
 </span>
<br>      在2017-08-28,"David Gobbi" <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> 写道:
        </span><blockquote id="m_5567654153334962732gmail-m_815751471093880078gmail-m_-1172525414657701273isReplyContent" style="padding-left:1ex;margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204)"><span class="m_5567654153334962732gmail-m_815751471093880078gmail-">
        -----原始邮件-----<br>
        <b>发件人:</b>"David Gobbi" <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> <br>
        <b>发送时间:</b>2017年08月28日 星期一<br>
        <b>收件人:</b>"Liu_tj" <<a href="mailto:tjlp@netease.com" target="_blank">tjlp@netease.com</a>><br>
        <b>抄送:</b>"vtkusers" <<a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a>><br>
        </span><b>主题:</b>Re: Re: What ditermines whether the slice order should be reversed?<div><div class="m_5567654153334962732gmail-m_815751471093880078gmail-h5"><br>
<br><div dir="ltr">Hi Liu Peng,<div><br></div><div>W<span style="font-size:12.8px">hat versions of VTK and vtk-dicom you are using?</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"> - David  </span></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 28, 2017 at 12:31 AM, Liu_tj <span dir="ltr"><<a href="mailto:tjlp@netease.com" target="_blank">tjlp@netease.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Hi, David,<br></div><div><br></div>
 <span>
 </span>
As far as I know, in the RCS system, the direction of Z axis is from foot to head.So by default, the slice order in your dicom reader is consistent with the RCS system.When the reader sorts the slices, does it consider the Patient Postion tag(0080,5100)? Some doctors might use some DICOM tools which the slice order is from head to foot and get used to that.<br><br>My code block for load slices is as follow:<br><br>       vtkStringArray* vtkDICOMFilePaths = vtkStringArray::New();<br>        vtkDICOMFilePaths->SetNumberOf<wbr>Values(aDICOMFilePaths->Length<wbr>);<br>        for(int i = 0; i < aDICOMFilePaths->Length; i ++)<br>        {<br>            String^ filePath = aDICOMFilePaths[i];<br>            const char* filePathByChars = MDKStringUtility::NStringToCha<wbr>rs(filePath);<br><br>            vtkDICOMFilePaths->SetValue(i, filePathByChars);<br>        }<br><br>        vtkDICOMReader* reader = vtkDICOMReader::New();<br>        vtkImageData* imageData = reader->GetOutput();<br><br>Thanks<br>Liu Peng<br>    在2017-08-28,"David Gobbi" <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> 写道:
        <blockquote id="m_5567654153334962732gmail-m_815751471093880078gmail-m_-1172525414657701273m_3909642038269937258isReplyContent" style="padding-left:1ex;margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204)">
        -----原始邮件-----<br>
        <b>发件人:</b>"David Gobbi" <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> <br>
        <b>发送时间:</b>2017年08月28日 星期一<br>
        <b>收件人:</b>"Liu_tj" <<a href="mailto:tjlp@netease.com" target="_blank">tjlp@netease.com</a>><br>
        <b>抄送:</b>"vtkusers" <<a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a>><br>
        <b>主题:</b>Re: What ditermines whether the slice order should be reversed?<div><div class="m_5567654153334962732gmail-m_815751471093880078gmail-m_-1172525414657701273h5"><br>
<br><div dir="ltr">Hi Liu Peng,<div><br></div><div>The vtkDICOMReader sorts according to the Image Plane Module:</div><div><a href="http://dicom.nema.org/MEDICAL/dicom/current/output/chtml/part03/sect_C.7.6.2.html" target="_blank">http://dicom.nema.org/MEDICAL/<wbr>dicom/current/output/chtml/par<wbr>t03/sect_C.7.6.2.html</wbr></wbr></a></div><div>That is, the slices are sorted in a manner such that the VTK image data has a right-handed coordinate system (called an RCS in the link above).</div><div><br></div><div>Sorting the slices to get an RCS means that sometimes the slices will be sorted the same as the InstanceNumber, and sometimes they will be sorted opposite to InstanceNumber, depending on the order in which scanner ordered the slices.</div><div><br></div><div>You can perform the sorting yourself by calling reader->SortingOff().  If Sorting is Off, the reader will take the slices in the same order as the vtkStringArray that you passed to reader->SetFileNames().</div><div><br></div><div>If you send me the block of code where you set up and call the reader, then I might be able to provide more help.  Don't forget to also say what versions of VTK and vtk-dicom you are using.</div><div><br></div><div>Cheers,</div><div> - David</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Aug 27, 2017 at 10:41 AM, Liu_tj <span dir="ltr"><<a href="mailto:tjlp@netease.com" target="_blank">tjlp@netease.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Hi,</div><div><br></div><div>I have a question about the DICOM slice order. I use the DICOM reader by David Gobbi to read the slice series to vtkImageData. And I found that the oder is the same as the order by DICOM instanceNumber tag. However, some doctors tell me that the order should be reversed because the scan should start from head to foot. <br></div><div><br></div><div>@David, if I need to reverse, how to achieve that by your DICOM reader?</div><div><br></div><div>Thanks</div><div>Liu Peng<br></div></blockquote></div></div></div></div></blockquote></wbr></wbr></wbr></blockquote></div></div></div></div></div></blockquote></blockquote></div><br></div></div>
</div></div></blockquote></wbr></wbr></blockquote></div><br></div></div></div>
</div></div></blockquote><br><br><span title="neteasefooter"><p> </p></span></blockquote></div><br></div></div>
</blockquote><br><br><span title="neteasefooter"><p> </p></span>