[ITK-users] DICOM Dataset GetOrigin
Matt McCormick
matt.mccormick at kitware.com
Mon May 1 11:18:12 EDT 2017
Hi Filippo,
Yes, those results are odd.
What is the resulting Spacing and Direction of the itk::Image?
Thanks,
Matt
On Mon, May 1, 2017 at 10:52 AM, Filippo Brogi <filippo.brogi at topic.nl>
wrote:
>
> Hello guys,
> I'm reading a dicom dataset formed by 17 MR images using ITK 4.9.1.
>
> According to the documentation "Origin" is the physical position of the
> pixel whose "Index" is all zeros, but the GetOrigin() method is returning
> the physical position of index = {0, 0, 16}.
>
>
> Here a simplified code snippet
>
> SeriesReaderType::Pointer reader = SeriesReaderType::New();
> ImageIOType::Pointer dicomIO = ImageIOType::New();
> reader->SetImageIO( dicomIO );
>
> // mFilenames contains the list of dicom files
> reader->SetFileNames ( mFileNames );
> try
> {
> reader->Update();
>
> auto pImage = reader->GetOutput();
>
> ShortImageType3D::PointType point1;
> ShortImageType3D::IndexType index1 = {0, 0, 0};
>
> pImage->TransformIndexToPhysicalPoint( index1, point1 );
>
> double imgPos[3];
> imgPos[0] = dicomIO->GetOrigin(0);
> imgPos[1] = dicomIO->GetOrigin(1);
> imgPos[2] = dicomIO->GetOrigin(2);
>
> ShortImageType3D::IndexType indexOfOrigin;
> ShortImageType3D::PointType point2;
> point2[0] = imgPos[0];
> point2[1] = imgPos[1];
> point2[2] = imgPos[2];
> pImage->TransformPhysicalPointToIndex(point2,
> indexOfOrigin);
> }
> catch(itk::ExceptionObject &)
> {
> std::cout << "ERROR" << std::endl;
> return res;
> }
>
> This is the console output:
>
> GetOrigin (-172.9, -116.666, 55.594)
> [-99.3719, -182.98, -25.5239] - index = [0, 0, 0]
> [-172.9, -116.666, 55.594] - index = [0, 0, 16]
>
> Am I doing something wrong?
> Thanks in advance
>
>
>
>
> --
> View this message in context: http://itk-users.7.n7.nabble.
> com/DICOM-Dataset-GetOrigin-tp38167.html
> Sent from the ITK - Users mailing list archive at Nabble.com.
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20170501/6d91ce23/attachment.html>
More information about the Insight-users
mailing list