Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question: how to get origin and spacing from dicom series images? #387

Closed
galactica147 opened this issue Feb 1, 2018 · 2 comments
Closed

Comments

@galactica147
Copy link

Hi,

I tried to find this online but there has been surprisingly little available.
Anyone knows how could we extract the origin and spacing information from the dicom series images?

Say I have a directory data_directory of dicom images, i could do something like the following:

series_IDs = sitk.ImageSeriesReader.GetGDCMSeriesIDs(data_directory)
series_file_names = sitk.ImageSeriesReader.GetGDCMSeriesFileNames(data_directory, series_IDs[0])
series_reader = sitk.ImageSeriesReader()
series_reader.SetFileNames(series_file_names)
series_reader.LoadPrivateTagsOn()
image3D=series_reader.Execute()
size = image3D.GetSize()

Now I can get the size of a 3D image, but have no idea how to find out other important information: origin of the world coordinate, and the spacing for x/y/z axis, etc.

Any ideas?
Thanks!

@galactica147
Copy link
Author

another search attempt got me there:

spacing = image3D.GetSpacing()
origin = image3D.GetOrigin()

FYI.

@blowekamp
Copy link
Member

Hi!

For the basics of an image you may want to look at the SimpleITK Notebook on the topic. This will cover the attributes that are intrinsic to ITK/SimpleITK images:
http://insightsoftwareconsortium.github.io/SimpleITK-Notebooks/Python_html/03_Image_Details.html

Additionally, for SimpleITK 1.0 we have an example on how to load the DICOM tags for individual dicom files (not a series):
https://itk.org/SimpleITKDoxygen100/html/DicomImagePrintTags_2DicomImagePrintTags_8py-example.html

Lastly in the current development master branch ( for forth coming 1.1 release ) we have added significant improvement for advanced meta-data dictionary usage:
http://simpleitk.readthedocs.io/en/master/Examples/DicomImagePrintTags/Documentation.html
http://simpleitk.readthedocs.io/en/master/Examples/DicomSeriesReadModifyWrite/Documentation.html˜

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants