[Insight-users] read dicom images, register and write out dicoms with no change in metadata

Mathieu Malaterre mathieu.malaterre at gmail.com
Mon Apr 7 18:31:40 EDT 2008


Hi Sirisha,

On Mon, Apr 7, 2008 at 10:31 PM, Tadimalla, Sirisha
<sirisha-tadimalla at uiowa.edu> wrote:
>
>
>
>
>  Hi,
>
>  I am trying to register two dicom MR images as part of a project. I need the dicom header information to be unchanged in the registered dicom output. I also need the Private tags in the output header. When I build and run it, I get a registered image in DICOM format, and I have most of the original header information, but it doesn't contain the private tags. Here is part of the code that I have used:
>
>  #include "itkGDCMImageIO.h"
>  #include "itkImageFileReader.h"
>  #include "itkImageFileWriter.h"
>
>  ReaderType::Pointer movingReader = ReaderType::New();
>  ImageIOType::Pointer movingdicomIO = ImageIOType::New();
>
>  movingReader->SetFileName( argv[2] );
>
>  movingReader->SetImageIO( movingdicomIO );
>  movingdicomIO->SetMaxSizeLoadEntry(0xffff);
>  movingdicomIO->LoadPrivateTagsOn();

LoadPrivateTagsOn only affect reading, it has no impact on what would
be written. Futhermore its name is actually misleading I'll update the
documentation.

>  movingdicomIO->KeepOriginalUIDOn();

You should not use that option, if you do not understand the
consequences, please.

>  /// Registration is done here and then the output dicom has to be written
>
>  writer->SetInput( caster->GetOutput() );
>  writer->SetImageIO( movingdicomIO );
>  writer->SetFileName( argv[3] );
>  writer->UseInputMetaDataDictionaryOff();
>
>  writer->Update();
>
>  Please help.

Private Tags are not (and will not be) loaded. They are simply
discarded when passing values from gdcm to the ITK meta data dict.

You understand that private tags do not contains any extra-added
information, right ? If so why are you trying to pass binary blob of
data back to the output ?

Anyway, if you know what you are doing, you can implement a 2 steps
process, where ITK write intermediary DICOM files, that you re-read
using low-level gdcm primitives and write back copying any needed
private tags from the original image. But -again- I strongly suggest
that you rethink your process, because in copying private tags without
fully understanding what you are doing, you may be copying information
from the original header that might override any information that ITK
will have computed during the registration process (typical example:
private tags to define the image position patient in conflict with the
public one).

>
>  Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged.  If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited.  Please reply to the sender that you have received the message in error, then delete it.  Thank you.
>

I am actually reading your email, from the gmane.org mirror of
itk-users archive, should I delete the web page :-P


-- 
Mathieu


More information about the Insight-users mailing list