<div dir="ltr">Hi Francois,<div><br></div><div>Thanks your help. We have solve the problem. The bug is related with SOPClassUID, current we saved as "<span style="font-size:12.8px">SecondaryCaptureImageStorage"<wbr>, after I changed to "</span><span style="font-size:12.8px">MRImageStorage", the data can load correctly in ITK-SNAP.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">So, I think ITK must have some </span><span style="font-size:12.8px">restriction on the </span>"<span style="font-size:12.8px">SecondaryCaptureImageStorage" data, it returned here and failed to read the actual image parameters.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Thanks!</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Ying</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 7, 2017 at 4:42 PM, Francois Budin <span dir="ltr"><<a href="mailto:francois.budin@kitware.com" target="_blank">francois.budin@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div>Hello Ying,<br><br></div>I do not know why this design was chosen in GDCM (default DICOM library used in ITK) for this type of MediaStorage. Maybe a DICOM expert can chip in.<br></div>However, you can also use DCMTK by activating Module_ITKDCMTK and Module_ITKIODCMTK in ITK's CMake configuration and then use itk::DCMTKImageIO as your image IO.<br></div>I was successful reading your resampled DICOM after renaming your images (1->01, 2->02,...)<br><br></div>Hope this helps,<br></div>Francois<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 7, 2017 at 3:35 PM, Ying Wang <span dir="ltr"><<a href="mailto:neuying@gmail.com" target="_blank">neuying@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks for these information! <div><br></div><div>I have a question about the second dataset, although it is defined as <span style="font-size:12.8px">"SecondaryCaptureImageStora<wbr>ge", why it use the default value "1" for </span><span style="font-size:12.8px">spacing between slices</span><span style="font-size:12.8px">? We already put "2" in tag (0018,0088).</span></div><span class="m_-2064590379367081987HOEnZb"><font color="#888888"><div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Ying</span></div></div></font></span></div><div class="m_-2064590379367081987HOEnZb"><div class="m_-2064590379367081987h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 7, 2017 at 12:41 PM, Francois Budin <span dir="ltr"><<a href="mailto:francois.budin@kitware.com" target="_blank">francois.budin@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div>Hello Ying and Sean,<br><br></div>You are correct, you did change the image position of the patient. The spacing is actually computed differently based on what information is provided in the DICOM tags.<br></div>In your case, the first DICOM you sent (before resampling), the z-spacing is correct only because it is "1". If it had been a different value in your DICOM, ITK (GDCM) would still have<br></div>set the spacing to the value "1". The image is defined as "MRImageStorage" and it reads the z-spacing in tag 0x0018,0x0088 [1] which is not set. So it sets the default value of "1", which in this<br>case matches what you expect.<br>In the case of the second dataset you sent (after resampling), the image modality is defined as "SecondaryCaptureImageStorage" [2], so it also sets the spacing to the default value "1".<br><br></div>As for the order in which the files are read, Bill is correct. The files are ordered by IPP, except if the image modality is "SecondaryCaptureImageStorage"<wbr>. [3]<br><br></div>I hope this helps,<br></div>Francois<br><div><div><div><br>[1] <a href="https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx#L1096-L1161" target="_blank">https://github.com/InsightSoft<wbr>wareConsortium/ITK/blob/master<wbr>/Modules/ThirdParty/GDCM/src/<wbr>gdcm/Source/MediaStorageAndFil<wbr>eFormat/gdcmImageHelper.cxx#<wbr>L1096-L1161</a><br>[2] <a href="https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/ThirdParty/GDCM/src/gdcm/Source/DataStructureAndEncodingDefinition/gdcmMediaStorage.cxx#L520-L585" target="_blank">https://github.com/InsightSoft<wbr>wareConsortium/ITK/blob/master<wbr>/Modules/ThirdParty/GDCM/src/<wbr>gdcm/Source/DataStructureAndEn<wbr>codingDefinition/gdcmMediaStor<wbr>age.cxx#L520-L585</a><br>[3] <a href="https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx#L468-L484" target="_blank">https://github.com/InsightSoft<wbr>wareConsortium/ITK/blob/master<wbr>/Modules/ThirdParty/GDCM/src/<wbr>gdcm/Source/MediaStorageAndFil<wbr>eFormat/gdcmImageHelper.cxx#<wbr>L468-L484</a><br></div></div></div></div><div class="m_-2064590379367081987m_-3666830815400749724HOEnZb"><div class="m_-2064590379367081987m_-3666830815400749724h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 6, 2017 at 4:23 PM, Ying Wang <span dir="ltr"><<a href="mailto:neuying@gmail.com" target="_blank">neuying@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Our function is down-sample/interpolation, to clear the confusion, the example is down-sample the slice thickness from 1 to 2 mm/pixel.<div>We use the z orientation and the first slice image position with the slice thickness to update all the image positions.<span class="m_-2064590379367081987m_-3666830815400749724m_1648208972880871579HOEnZb"><font color="#888888"><br><div><br></div><div>Ying</div></font></span></div></div><div class="m_-2064590379367081987m_-3666830815400749724m_1648208972880871579HOEnZb"><div class="m_-2064590379367081987m_-3666830815400749724m_1648208972880871579h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 6, 2017 at 4:18 PM, Ying Wang <span dir="ltr"><<a href="mailto:neuying@gmail.com" target="_blank">neuying@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Francois,<div><br></div><div>Does ITK use the tag (0020,0032) to read the image position of patient? Actually, we already update this information after the interpolation on each of slices.</div><div><br></div><div>The original image, </div><div>1st slice, (0020,0032) DS [-99.730746057061\-117.6936650<wbr>3814\-55.15114060703] # 50, 3 ImagePositionPatient</div><div>2nd slice, (0020,0032) DS [-99.730746057061\-117.5666004<wbr>2109\-54.159246165521] # 50, 3 ImagePositionPatient</div><div>That's mean the slice thickness is 1mm/pixel.</div><div><br></div><div>While after interpolation, we saved the image,</div><div>1st slice, (0020,0032) DS [-99.7307\-117.694\-55.1511] # 26, 3 ImagePositionPatient</div><div>2nd slice,(0020,0032) DS [-99.7307\-117.44\-53.1674] # 26, 3 ImagePositionPatient</div><div>That's mean the slice thickness is 2mm/pixel.</div><div><br></div><div>Does these right? we want to know which tag are you using and we can modify our software for writing DICOM. Thanks again!</div><span class="m_-2064590379367081987m_-3666830815400749724m_1648208972880871579m_-696341274712708675HOEnZb"><font color="#888888"><div><br></div><div>Ying</div><div><br></div><div><br></div></font></span></div><div class="gmail_extra"><div><div class="m_-2064590379367081987m_-3666830815400749724m_1648208972880871579m_-696341274712708675h5"><br><div class="gmail_quote">On Thu, Jul 6, 2017 at 4:01 PM, Francois Budin <span dir="ltr"><<a href="mailto:francois.budin@kitware.com" target="_blank">francois.budin@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Hello Sean,<br><br></div>As Bill said, it is the slice location that is used to compute the image spacing: The average spacing between all slices is computed and sets as your output image interslice spacing.<br></div>For the order of the files though, it is based on the order in which the files are given to the image reader. Typically, one uses "itk::GDCMSeriesFileNames" and sets an input directory. This will create a list of all the files contained in that directory and these files will be ordered alphabetically. That means that 1.dcm is after 01.dcm, 2.dcm is after 11.dcm, and so on. You can either rename your files to make sure that they are ordered correctly, as you did, or use a customized function to generate your series of files to read that fits your need.<br><br></div>Hope this helps,<br></div>François<br></div><div class="m_-2064590379367081987m_-3666830815400749724m_1648208972880871579m_-696341274712708675m_4575941395491853812HOEnZb"><div class="m_-2064590379367081987m_-3666830815400749724m_1648208972880871579m_-696341274712708675m_4575941395491853812h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 6, 2017 at 3:42 PM, Sean Sethi <span dir="ltr"><<a href="mailto:sethisea@gmail.com" target="_blank">sethisea@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Bill, <div><br></div><div>I shared this information with our developer. We already rewrite image position in our processed data. Can you please look at the data sets which I linked?<div><br></div><div>And I have to disagree about the display of the image. I attached image showing ITK's display of dicoms before and after I renamed the filenames only. You can see the beforehand image where the discontinuities are in coronal and sagittal view. Those headers should be the same since I did not change them.</div><span class="m_-2064590379367081987m_-3666830815400749724m_1648208972880871579m_-696341274712708675m_4575941395491853812m_-6079054011010671672HOEnZb"><font color="#888888"><div><br></div><div>Sean<br></div></font></span></div></div><div class="m_-2064590379367081987m_-3666830815400749724m_1648208972880871579m_-696341274712708675m_4575941395491853812m_-6079054011010671672HOEnZb"><div class="m_-2064590379367081987m_-3666830815400749724m_1648208972880871579m_-696341274712708675m_4575941395491853812m_-6079054011010671672h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 6, 2017 at 2:59 PM, Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>It's uses the image position patient tag to determine slice location. Image spacing is not used. Also, it does not use the name of them for ordering. Once again it uses Ipp.</div><div id="m_-2064590379367081987m_-3666830815400749724m_1648208972880871579m_-696341274712708675m_4575941395491853812m_-6079054011010671672m_8873317590970711626m_-2027775201008624747AppleMailSignature"><br></div><div id="m_-2064590379367081987m_-3666830815400749724m_1648208972880871579m_-696341274712708675m_4575941395491853812m_-6079054011010671672m_8873317590970711626m_-2027775201008624747AppleMailSignature">This is common practice in medical image processing software.<br><br>Sent from my iPad</div><div><div class="m_-2064590379367081987m_-3666830815400749724m_1648208972880871579m_-696341274712708675m_4575941395491853812m_-6079054011010671672m_8873317590970711626h5"><div><br>On Jul 6, 2017, at 12:11 PM, Sean Sethi <<a href="mailto:sethisea@gmail.com" target="_blank">sethisea@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">Hi everyone,<div><br></div><div>I am encountering a dicom read issue with data that was processed using a collapsing filter by our software. The <a href="https://www.dropbox.com/s/wsf6rb3edoritj9/02-MPRAGE%20T1.zip?dl=0" target="_blank">original data</a> is 0.5x0.5x1 mm^3 which is collapsed to a <a href="https://www.dropbox.com/s/7f34ahrmho938gb/KCROP1X1X2.zip?dl=0" target="_blank">dataset of 1x1x2 mm^3.</a></div><div><br></div><div>The first error that is noticed is the data appear squished axially, and the slice thickness is incorrectly read, even though the header file has the correct information. (slice thickness=2, spacing between slices=2). </div><div><br></div><div><div>The second error that I see is due to it incorrectly reading the numbering of the dicoms. It shows every 11th or so image as out of order, which is coming from reading the numbers in order of 1, 10, 11, 12 etc instead of 1, 2,3. When the files are number 01, 02, 03, the issue is corrected, but image still appears squashed.</div><div><br></div><div>Both the issues are also corrected when the collapsed data is converted to NIFTI. So my question is how should we write our DICOM files so they are read correctly? Are the thicknesses and spacings computed from other tag(s)? </div><div><br></div><div>Thank you for consideration,</div><div><br></div><div><span style="font-size:12.8px">Sean</span><br style="font-size:12.8px" clear="all"></div></div><div><span style="font-size:12.8px"><br></span></div><div><br></div>-- <br><div class="m_-2064590379367081987m_-3666830815400749724m_1648208972880871579m_-696341274712708675m_4575941395491853812m_-6079054011010671672m_8873317590970711626m_-2027775201008624747gmail_signature"><div dir="ltr"><div>Sean Sethi, M.S.<br>Research, The MRI Institute for Biomedical Research </div><div>Data processing, Magnetic Resonance Innovations, Inc.<br>440 East Ferry Street, Unit #1<br>Detroit, MI 48202<br><a href="tel:(313)%20758-0065" value="+13137580065" target="_blank">(313) 758-0065</a> - Tel<br><a href="tel:(313)%20758-0068" value="+13137580068" target="_blank">(313) 758-0068</a> - Fax<br><a href="mailto:sethisea@gmail.com" target="_blank">sethisea@gmail.com</a><br><a href="http://www.mrimaging.com/" style="font-size:12.8px" target="_blank">http://www.mrimaging.com/</a><br></div><div><a href="http://www.mrinnovations.com" target="_blank">http://<span style="font-size:12.8px">www.mrinnovations.com</span></a><br></div></div></div>
</div>
</div></blockquote></div></div><blockquote type="cite"><div><span>______________________________<wbr>_________________</span><br><span>Community mailing list</span><br><span><a href="mailto:Community@itk.org" target="_blank">Community@itk.org</a></span><br><span><a href="http://public.kitware.com/mailman/listinfo/community" target="_blank">http://public.kitware.com/mail<wbr>man/listinfo/community</a></span><br></div></blockquote></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_-2064590379367081987m_-3666830815400749724m_1648208972880871579m_-696341274712708675m_4575941395491853812m_-6079054011010671672m_8873317590970711626gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Sean Sethi, M.S.<br>Research, The MRI Institute for Biomedical Research </div><div>Data processing, Magnetic Resonance Innovations, Inc.<br>440 East Ferry Street, Unit #1<br>Detroit, MI 48202<br><a href="tel:(313)%20758-0065" value="+13137580065" target="_blank">(313) 758-0065</a> - Tel<br><a href="tel:(313)%20758-0068" value="+13137580068" target="_blank">(313) 758-0068</a> - Fax<br><a href="mailto:sethisea@gmail.com" target="_blank">sethisea@gmail.com</a><br><a href="http://www.mrimaging.com/" style="font-size:12.8px" target="_blank">http://www.mrimaging.com/</a><br></div><div><a href="http://www.mrinnovations.com" target="_blank">http://<span style="font-size:12.8px">www.mrinnovations.com</span></a><br></div></div></div>
</div>
</div></div><br>______________________________<wbr>_________________<br>
Community mailing list<br>
<a href="mailto:Community@itk.org" target="_blank">Community@itk.org</a><br>
<a href="http://public.kitware.com/mailman/listinfo/community" rel="noreferrer" target="_blank">http://public.kitware.com/mail<wbr>man/listinfo/community</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div></div></div><span>-- <br><div class="m_-2064590379367081987m_-3666830815400749724m_1648208972880871579m_-696341274712708675m_4575941395491853812gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><span style="color:rgb(136,136,136)">Ying Wang</span><br><span style="color:rgb(153,153,153)">Research Assistant</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Department of Biomedical Engineering</span><br></div><span style="color:rgb(153,153,153)"><span style="background-color:rgb(255,255,255)">Wayne State University</span></span><br style="color:rgb(136,136,136)"><div><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">440 East Ferry Street </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Detroit, MI 48202</span><br style="color:rgb(136,136,136)"><a style="color:rgb(136,136,136)" value="+13137580065">313-758-0065</a><span style="color:rgb(136,136,136)"> - Tel Ext: 30</span><br style="color:rgb(136,136,136)"><a style="color:rgb(136,136,136)" value="+13137580068">313-758-0068</a><span style="color:rgb(136,136,136)"> - Fax </span><br style="color:rgb(136,136,136)"><a href="mailto:neuying@gmail.com" target="_blank">neuying@gmail.com</a><span style="color:rgb(136,136,136)"> - Email</span>
</div></div></div>
</span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_-2064590379367081987m_-3666830815400749724m_1648208972880871579m_-696341274712708675gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><span style="color:rgb(136,136,136)">Ying Wang</span><br><span style="color:rgb(153,153,153)">Research Assistant</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Department of Biomedical Engineering</span><br></div><span style="color:rgb(153,153,153)"><span style="background-color:rgb(255,255,255)">Wayne State University</span></span><br style="color:rgb(136,136,136)"><div><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">440 East Ferry Street </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Detroit, MI 48202</span><br style="color:rgb(136,136,136)"><a style="color:rgb(136,136,136)" value="+13137580065">313-758-0065</a><span style="color:rgb(136,136,136)"> - Tel Ext: 30</span><br style="color:rgb(136,136,136)"><a style="color:rgb(136,136,136)" value="+13137580068">313-758-0068</a><span style="color:rgb(136,136,136)"> - Fax </span><br style="color:rgb(136,136,136)"><a href="mailto:neuying@gmail.com" target="_blank">neuying@gmail.com</a><span style="color:rgb(136,136,136)"> - Email</span>
</div></div></div>
</div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_-2064590379367081987m_-3666830815400749724gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><span style="color:rgb(136,136,136)">Ying Wang</span><br><span style="color:rgb(153,153,153)">Research Assistant</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Department of Biomedical Engineering</span><br></div><span style="color:rgb(153,153,153)"><span style="background-color:rgb(255,255,255)">Wayne State University</span></span><br style="color:rgb(136,136,136)"><div><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">440 East Ferry Street </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Detroit, MI 48202</span><br style="color:rgb(136,136,136)"><a style="color:rgb(136,136,136)" value="+13137580065">313-758-0065</a><span style="color:rgb(136,136,136)"> - Tel Ext: 30</span><br style="color:rgb(136,136,136)"><a style="color:rgb(136,136,136)" value="+13137580068">313-758-0068</a><span style="color:rgb(136,136,136)"> - Fax </span><br style="color:rgb(136,136,136)"><a href="mailto:neuying@gmail.com" target="_blank">neuying@gmail.com</a><span style="color:rgb(136,136,136)"> - Email</span>
</div></div></div>
</div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><span style="color:rgb(136,136,136)">Ying Wang</span><br><span style="color:rgb(153,153,153)">Research Assistant</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Department of Biomedical Engineering</span><br></div><span style="color:rgb(153,153,153)"><span style="background-color:rgb(255,255,255)">Wayne State University</span></span><br style="color:rgb(136,136,136)"><div><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">440 East Ferry Street </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Detroit, MI 48202</span><br style="color:rgb(136,136,136)"><a style="color:rgb(136,136,136)" value="+13137580065">313-758-0065</a><span style="color:rgb(136,136,136)"> - Tel Ext: 30</span><br style="color:rgb(136,136,136)"><a style="color:rgb(136,136,136)" value="+13137580068">313-758-0068</a><span style="color:rgb(136,136,136)"> - Fax </span><br style="color:rgb(136,136,136)"><a href="mailto:neuying@gmail.com" target="_blank">neuying@gmail.com</a><span style="color:rgb(136,136,136)"> - Email</span>
</div></div></div>
</div>