Discussion:
[ITK-users] using MHA file to store additional information about image
Andrew Harris
2018-05-30 18:53:40 UTC
Permalink
Hello, I was wondering if it is possible to store additional information
about an image as part of an MHA file. Specifically, we are capturing
ultrasound using an arm that has encoders attached that report position in
space, and I'd like to be able to include that information in the MHA file
rather than keeping a separate record. Thanks in advance for the help.

--

AH


Andrew Harris, BSc with Honours (Medical Physics)

PhD (CAMPEP) & MClSc Candidate

-----------------------------------------------------------------------------------------------

*This email and any attachments thereto may contain private,
confidential, and privileged materials for the sole use of the intended
recipient. Any reviewing, copying, or distribution of this email (or any
attachments thereto) by other than the intended recipient is strictly
prohibited. If you are not the intended recipient, please contact the
sender immediately and permanently destroy this email and any attachments
thereto.*
Yaniv, Ziv Rafael (NIH/NLM/LHC) [C]
2018-05-30 20:10:03 UTC
Permalink
Hello Andrew,

The users mailing list for ITK has moved to a discussion forum: https://discourse.itk.org/, please post there in the future.

I do not think that the MHA format will allow you to do this, but maybe I’m wrong.

This is relatively common using the DICOM format and private tags (pp. 59 in part 5 of the standard, http://dicom.nema.org/medical/dicom/current/output/pdf/part05.pdf).

The SimpleITK code below does what I believe you want (too long for ITK here).

hope this helps
Ziv

import SimpleITK as sitk

private_creator = "0009|0010"
private_tag = "0009|0011"

img = sitk.Image((128,128), sitk.sitkUInt8)
img.SetMetaData(private_creator, "UWO Encoder Values")
img.SetMetaData(private_tag,"0.18 0.76 0.97 0.87")
sitk.WriteImage(img, "image_with_encoder_data.dcm")

# read the image we just wrote, tell the reader to load the private tags
image_reader = sitk.ImageFileReader()
image_reader.SetFileName("image_with_encoder_data.dcm")
image_reader.LoadPrivateTagsOn()
img_read = image_reader.Execute()
encoder_values_string = img_read.GetMetaData(private_tag)

# convert the returned string to a list of floats
encoder_values = [float(x) for x in encoder_values_string.split()]



From: Andrew Harris <***@uwo.ca>
Date: Wednesday, May 30, 2018 at 2:54 PM
To: Insight-users <insight-***@itk.org>
Subject: [ITK] [ITK-users] using MHA file to store additional information about image

Hello, I was wondering if it is possible to store additional information about an image as part of an MHA file. Specifically, we are capturing ultrasound using an arm that has encoders attached that report position in space, and I'd like to be able to include that information in the MHA file rather than keeping a separate record. Thanks in advance for the help.
--
AH



Andrew Harris, BSc with Honours (Medical Physics)

PhD (CAMPEP) & MClSc Candidate

-----------------------------------------------------------------------------------------------

This email and any attachments thereto may contain private, confidential, and privileged materials for the sole use of the intended recipient. Any reviewing, copying, or distribution of this email (or any attachments thereto) by other than the intended recipient is strictly prohibited. If you are not the intended recipient, please contact the sender immediately and permanently destroy this email and any attachments thereto.
Dženan Zukić
2018-05-30 20:25:35 UTC
Permalink
Hi Andrew,

you can add content to image's MetaData dictionary. But you should look at
how Plus does it (code
<https://github.com/PlusToolkit/PlusLib/blob/master/src/PlusCommon/IO/vtkPlusMetaImageSequenceIO.cxx>
, docs
<http://perk-software.cs.queensu.ca/plus/doc/nightly/dev/vtkPlusMetaImageSequenceIO_8h.html>).
You might be able to use it directly.

Regards,
DÅŸenan
Post by Andrew Harris
Hello, I was wondering if it is possible to store additional information
about an image as part of an MHA file. Specifically, we are capturing
ultrasound using an arm that has encoders attached that report position in
space, and I'd like to be able to include that information in the MHA file
rather than keeping a separate record. Thanks in advance for the help.
--
AH
Andrew Harris, BSc with Honours (Medical Physics)
PhD (CAMPEP) & MClSc Candidate
-----------------------------------------------------------------------------------------------
*This email and any attachments thereto may contain private,
confidential, and privileged materials for the sole use of the intended
recipient. Any reviewing, copying, or distribution of this email (or any
attachments thereto) by other than the intended recipient is strictly
prohibited. If you are not the intended recipient, please contact the
sender immediately and permanently destroy this email and any attachments
thereto.*
The ITK community is transitioning from this mailing list to
discourse.itk.org. Please join us there!
________________________________
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
https://itk.org/mailman/listinfo/insight-users
Andras Lasso
2018-05-31 02:59:25 UTC
Permalink
Yes, Plus toolkit has been using mha and nrrd files for many years to store tracked ultrasound data in a single file. Recently we use nrrd format more, as this format supports 3D+t image sequences more cleanly. At the beginning, we used ITK’s reader/writer, but metadata handling was not fast enough and we also needed dynamic header construction and memory-cached compressed streaming image I/O. We are now also adding support for lossy video codecs as non-standard extensions.

Plus can reconstruct volumes from tracked ultrasound slices, connect to many ultrasound devices through native interfaces, connect to most optical and electromagnetic trackers, stream tracked ultrasound data through OpenIGTLink for real-time visualization to various applications, perform spatial and temporal calibrations, etc. Check out www.plustoolkit.org<http://www.plustoolkit.org> and www.slicerigt.org<http://www.slicerigt.org> for details. There is a resident Plus expert at Robarts, Adam Rankin, you can contact him if you need more information, and we’ll have a one-week hackathon at Robarts in July where you can meet several experienced Plus and SlicerIGT users and developers (https://na-mic.github.io/ProjectWeek/PW29_2018_London_Canada/).

Andras

From: Community <community-***@itk.org> On Behalf Of DÅŸenan Zukic
Sent: Wednesday, May 30, 2018 4:26 PM
To: Andrew Harris <***@uwo.ca>
Cc: Insight-users <insight-***@itk.org>
Subject: Re: [ITK] [ITK-users] using MHA file to store additional information about image

Hi Andrew,

you can add content to image's MetaData dictionary. But you should look at how Plus does it (code<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FPlusToolkit%2FPlusLib%2Fblob%2Fmaster%2Fsrc%2FPlusCommon%2FIO%2FvtkPlusMetaImageSequenceIO.cxx&data=02%7C01%7Classo%40queensu.ca%7C5a34db5cc49149f2b77b08d5c66b8a59%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636633087559034726&sdata=9JCBbDgxqHogvLhKlhy8Vnk1SkRhFbgJFck%2Fy77KtEg%3D&reserved=0>, docs<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fperk-software.cs.queensu.ca%2Fplus%2Fdoc%2Fnightly%2Fdev%2FvtkPlusMetaImageSequenceIO_8h.html&data=02%7C01%7Classo%40queensu.ca%7C5a34db5cc49149f2b77b08d5c66b8a59%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636633087559034726&sdata=NtNk%2Ftz712R0RIsO8YXlff2ds16C%2BVpZtgZpKWiCu3k%3D&reserved=0>). You might be able to use it directly.

Regards,
DÅŸenan

On Wed, May 30, 2018 at 2:53 PM Andrew Harris <***@uwo.ca<mailto:***@uwo.ca>> wrote:
Hello, I was wondering if it is possible to store additional information about an image as part of an MHA file. Specifically, we are capturing ultrasound using an arm that has encoders attached that report position in space, and I'd like to be able to include that information in the MHA file rather than keeping a separate record. Thanks in advance for the help.
--
AH



Andrew Harris, BSc with Honours (Medical Physics)

PhD (CAMPEP) & MClSc Candidate

-----------------------------------------------------------------------------------------------

This email and any attachments thereto may contain private, confidential, and privileged materials for the sole use of the intended recipient. Any reviewing, copying, or distribution of this email (or any attachments thereto) by other than the intended recipient is strictly prohibited. If you are not the intended recipient, please contact the sender immediately and permanently destroy this email and any attachments thereto.
The ITK community is transitioning from this mailing list to discourse.itk.org<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdiscourse.itk.org&data=02%7C01%7Classo%40queensu.ca%7C5a34db5cc49149f2b77b08d5c66b8a59%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636633087559034726&sdata=F%2F2FM4Gx3T8lnoTySGCAEwFinDW8L7MYnJrHnNwV86Y%3D&reserved=0>. Please join us there!
________________________________
Powered by www.kitware.com<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com&data=02%7C01%7Classo%40queensu.ca%7C5a34db5cc49149f2b77b08d5c66b8a59%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636633087559034726&sdata=ZMXFx9lMJo9Hask7X6sNVE9PffQs23XxMXoPsxToXKg%3D&reserved=0>

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7C5a34db5cc49149f2b77b08d5c66b8a59%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636633087559034726&sdata=7TlJGDrfCE7jP2HMG1FVEXDv9vb6TOfQXvQvpxXtOLY%3D&reserved=0>

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fproducts%2Fprotraining.php&data=02%7C01%7Classo%40queensu.ca%7C5a34db5cc49149f2b77b08d5c66b8a59%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636633087559034726&sdata=QBCbC5%2BC2OfECc3CAh8xm9sRj1W5QB9bAA7zJW1hPAs%3D&reserved=0>

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.itk.org%2FWiki%2FITK_FAQ&data=02%7C01%7Classo%40queensu.ca%7C5a34db5cc49149f2b77b08d5c66b8a59%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636633087559034726&sdata=nl8SjXiDbYKLqy7hYt13IrHs9EYXNsu58ESqxPFgQVc%3D&reserved=0>

Follow this link to subscribe/unsubscribe:
https://itk.org/mailman/listinfo/insight-users<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fitk.org%2Fmailman%2Flistinfo%2Finsight-users&data=02%7C01%7Classo%40queensu.ca%7C5a34db5cc49149f2b77b08d5c66b8a59%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636633087559034726&sdata=u7z2GjFpflP2RxrZJzl%2F2zNwJ9ie9bHMOA8bK9sycPk%3D&reserved=0>
Loading...