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

Tadimalla, Sirisha sirisha-tadimalla at uiowa.edu
Wed Apr 9 14:09:42 EDT 2008


Hi Mathieu, 

I dont want to print out the tag. After loading the element in the file f1, how do I get it into the writers imageIO object? so normally i would simply 
say, writer->SetImageIO( dicomIO );

How do I get this tag value into dicomIO?

-Sirisha



-----Original Message-----
From: Mathieu Malaterre [mailto:mathieu.malaterre at gmail.com]
Sent: Wed 4/9/2008 7:23 AM
To: Tadimalla, Sirisha
Cc: insight-users at itk.org
Subject: Re: [Insight-users] read dicom images,register and write out dicoms with no change in metadata
 
Sirisha,

  Try something like that:

     gdcm::File *f1= new gdcm::File( );
     f1->SetFileName( filename );
     f1->SetMaxSizeLoadEntry( 0xffff ); // just in case
     f1->AddForceLoadElement( 0029, 1020);
     f1->Load();

   gdcm::DocEntry *dicom_tag_doc = f1->GetDocEntry(group, elem);
   gdcm::BinEntry *dicom_tag = dynamic_cast<gdcm::BinEntry*>(dicom_tag_doc);


  Since you are working with the famous 0029,"SIEMENS CSA HEADER",xx20
tag, I would also suggest to have a look at: exExtractTag.cxx which
was written exactly for this purpose in mind (extract this particular
tag).

   BTW, you are refering to gdcm CVS, while ITK still comes with gdcm
1.2, please make sure to get the last gdcm 1.2.x.

  And one different subject, you understand that the content of this
particular DICOM tag is fairly difficult to read, right ? I have done
some reverse engineering on that tag, and gdcm CVS has now an
executable that can dump the information encoded in the binary blob
see: exExtractCSA.cxx / exExtractCSATag.cxx.
  And one more thing, gdcm 2.x has a complete API to programmtically
extract field from a CSA Header (this binary blob you are looking at).
This will comes very handy for people looking to extract DWI/DTI
related information in SIEMENS images.

HTH
-Mathieu


On Wed, Apr 9, 2008 at 12:48 AM, Tadimalla, Sirisha
<sirisha-tadimalla at uiowa.edu> wrote:
> Hi,
>
>  Yes, I am not changing the tags. I just need it to be there in the registered image for later use.
>
>  Mathieu, I looked at the example in gdcm, and it seems like I should read in the tag content into a string.
>  f = GDCM_NAME_SPACE::File::New();
>  f->SetFileName( filename );
>  f->AddForceLoadElement( 0029, 1020);
>  std::string T1rho_value = f->GetEntryString( 0029, 1020);
>
>  But I dont know how to use it in my program. This is the first time I am using ITK, please bear with me.
>  Thank you
>
>  -Sirisha
>
>
>
>  Hi Mathieu,
>
>   I've had occasional need to reference a vender private tag for
>  processing.  I'm guessing Sirisha needs to look at a vender private tag
>  generated by the scanner, not insert a new one.  DICOM does not require
>  an implementation to preserve private tags, but sometimes it's a nice
>  feature.
>
>  -dan
>
>  -----Original Message-----
>  From: insight-users-bounces at itk.org
>  [mailto:insight-users-bounces at itk.org] On Behalf Of Mathieu Malaterre
>  Sent: Tuesday, April 08, 2008 3:29 PM
>  To: Tadimalla, Sirisha
>  Cc: insight-users at itk.org
>  Subject: Re: [Insight-users] read dicom images,register and write out
>  dicoms with no change in metadata
>
>  Hi Sirisha,
>
>   Please CC the itk users mailing list as others might benefit from this
>  thread too. See my comments interlaced.
>
>
>  On Tue, Apr 8, 2008 at 6:32 PM, Tadimalla, Sirisha
>  <sirisha-tadimalla at uiowa.edu> wrote:
>  > Hi Mathieu,
>  >
>  >  Thanks for replying. I need one particular private tag to remain in
>  > the  output header. I will be using it for further processing of the
>  > image in  MATLAB.
>
>  Don't take me as arrogant, but this not something you should be doing.
>  Why don't you set a particular comment in Ipublic tags, such as mage
>  Comments (0020,4000). Private tags belong to the private vendor and
>  -again- you should not manipulate them AFAIK. Unless of course you are
>  creating your set of private tags, in which case you can do whatever you
>  like.
>
>  >  Can you elaborate on how I can extract this from the input and copy
>  > it  for writing?
>  >
>
>  Get the gdcm 1.2 tarball from the official repository and have a look
>  at: exReadWriteFile.cxx for instance (any other example in the
>  gdcm/Example should be a good starting point).
>
>
>  >  Another issue that I have is that I use the registered image pixel
>  > values for a curve fitting procedure, so I need those values to remain
>
>  > the same. The original pixel values are doubles, but GDCM doesn't
>  > accept  it when I define my pixeltype as double. What should I do?
>
>  It should work out of the box. Are you copying back everything from the
>  meta data dictionary (see itk user guide for example) ? If so make sure
>  you are not dropping actidentally the Rescale Slope / Rescale Intercept
>  DICOM tag. They are used at read time to convert the stored pixel into
>  your 'double' pixel type, and then again at write time to convert your
>  double pixel type to regular DICOM pixel type (generally 16bits unsigned
>  short). Be sure to keep the same Rescale Slope / Rescale Intercept to
>  avoid any data loss.
>
>
>  HTH
>  --
>  Mathieu
>  _______________________________________________
>  Insight-users mailing list
>  Insight-users at itk.org
>  http://www.itk.org/mailman/listinfo/insight-users
>
>



-- 
Mathieu



More information about the Insight-users mailing list