Discussion:
[ITK-users] DICOM Dataset GetOrigin
Filippo Brogi
2017-05-01 14:52:26 UTC
Permalink
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
Matt McCormick
2017-05-01 15:18:12 UTC
Permalink
Hi Filippo,

Yes, those results are odd.

What is the resulting Spacing and Direction of the itk::Image?

Thanks,
Matt
Post by Filippo Brogi
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;
}
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
http://www.kitware.com/products/protraining.php
http://www.itk.org/Wiki/ITK_FAQ
http://public.kitware.com/mailman/listinfo/insight-users
Filippo Brogi
2017-05-01 15:37:48 UTC
Permalink
Hi Matt,
thanks for your reply, this is the 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]
Spacing (1.25, 1.25, 8)
Dimensions (256, 256, 1)
Direction ((0.74092, -2.22888e-008, 0.671593),(0.347938, 0.855333,
-0.383855),(-0.574435, 0.518079, 0.633733))

What it is also odd the Dimension, I would expect Dimensions(2) to be equal
to 17, the number of slices







--
View this message in context: http://itk-users.7.n7.nabble.com/DICOM-Dataset-GetOrigin-tp38167p38171.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
Mike Chinander
2017-05-01 15:44:29 UTC
Permalink
Are you sure all your files belong to the same image series (have the same
SeriesUID)? How are you populating mFileNames and what does it contain?
Post by Filippo Brogi
Hi Matt,
thanks for your reply, this is the 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]
Spacing (1.25, 1.25, 8)
Dimensions (256, 256, 1)
Direction ((0.74092, -2.22888e-008, 0.671593),(0.347938, 0.855333,
-0.383855),(-0.574435, 0.518079, 0.633733))
What it is also odd the Dimension, I would expect Dimensions(2) to be equal
to 17, the number of slices
--
View this message in context: http://itk-users.7.n7.nabble.
com/DICOM-Dataset-GetOrigin-tp38167p38171.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
http://www.kitware.com/products/protraining.php
http://www.itk.org/Wiki/ITK_FAQ
http://public.kitware.com/mailman/listinfo/insight-users
Filippo Brogi
2017-05-01 16:03:52 UTC
Permalink
Hi Mike,
I'm sure that the files belongs to the same series. These images belongs to
a multiphase cardiac dataset.

all the images they have the same series UID
1.3.46.670589.11.41301.5.0.10016.2015052010370537279

the only difference with a "common" dataset is that the instance number is
increased by the number of phases. For instance in this data I have

for image 1 = InstanceNumber 1
for image 2 = InstanceNumber 31
......
for image 17 = InstanceNumber 481

Is ITK expecting consecutive instance numbers?

Thanks



--
View this message in context: http://itk-users.7.n7.nabble.com/DICOM-Dataset-GetOrigin-tp38167p38173.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
Filippo Brogi
2017-05-09 08:52:53 UTC
Permalink
I used another dataset and I'm getting the same issue. This dataset is a ct
dataset single phase. dimension[2] should not be equal to the number of
images forming the dataset?



--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/ITK-users-DICOM-Dataset-GetOrigin-tp7589879p7589905.html
Sent from the ITK Insight 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
Francois Budin
2017-05-09 13:10:48 UTC
Permalink
Hello Filipo,

It looks like the image series reader only read the last image. Are you
reading the origin on "dicomIO" or on the output of the reader (e.g.
reader->GetOutput()->GetOrigin())?

Francois
Post by Filippo Brogi
I used another dataset and I'm getting the same issue. This dataset is a ct
dataset single phase. dimension[2] should not be equal to the number of
images forming the dataset?
--
View this message in context: http://itk-insight-users.
2283740.n2.nabble.com/ITK-users-DICOM-Dataset-GetOrigin-
tp7589879p7589905.html
Sent from the ITK Insight 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
http://www.kitware.com/products/protraining.php
http://www.itk.org/Wiki/ITK_FAQ
http://public.kitware.com/mailman/listinfo/insight-users
Loading...