[ITK] [ITK-users] Writing a DICOM file while preserving input image properties

Sarthak P scapegoat.sarthak at gmail.com
Thu Mar 9 14:54:24 EST 2017


Hi Todd,

Would it be possible for you to share the itkGDCMImageIO class somehow? I
tried making the edits you suggested but wasn't able to get it to work
properly.

Thanks,
Sarthak

On Thu, Mar 9, 2017 at 2:11 PM, Todd Jensen <todd.jensen at ieee.org> wrote:

>
> From: Sarthak P <scapegoat.sarthak at gmail.com>
> To: Matt McCormick <matt.mccormick at kitware.com>
> Cc: "insight-users at itk.org" <insight-users at itk.org>
> Subject: Re: [ITK] [ITK-users] Writing a DICOM file while preserving
> input image properties
> Message-ID:
> <CAEcjzFHR+hm0-mM3biCXpzhaOv=M+G5FVO1sG+9mnz8SFRr5Dw at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> So the thing is that even the origin isn't picked up when reading the DICOM
> image (it is always 0,0,0) so I am guessing I am doing something wrong when
> writing into the tag 0020|0032 itself. Once that is rectified, the spacing
> information (should) correct itself.
>
>
> I also had to add code to handle the origin and direction to the new Write
> method in the extended class (see previous message):
>
> double ipp[ 3 ] = { 0 };
> if ( itk::ExposeMetaData< vcl_string >( dict, "0020|0032", tmpStr ) )
> {
> if ( sscanf( tmpStr.c_str(), "%lf\\%lf\\%lf", &ipp[ 0 ], &ipp[ 1 ], &ipp[
> 2 ] ) == 3 )
> {
> for ( unsigned int i = 0; i < 3; i++ )
> {
> m_Origin[ i ] = ipp[ i ];
> }
> }
> else
> {
> // error
> }
> }
> double dir[ 6 ] = {1,0,0,0,1,0};
> if ( itk::ExposeMetaData< vcl_string >( dict, "0020|0037", tmpStr ) )
> {
> if ( sscanf( tmpStr.c_str(), "%lf\\%lf\\%lf\\%lf\\%lf\\%lf", &dir[ 0 ],
> &dir[ 1 ], &dir[ 2 ] , &dir[ 3 ], &dir[ 4 ], &dir[ 5 ] ) == 6 )
> {
> for ( unsigned int i = 0; i < 2; i++ )
> {
> for ( unsigned int j = 0; j < 3; j++ )
> {
> m_Direction[ i ][ j ] = dir[ ( i * 3 ) + j ];
> }
> }
> }
> else
> {
> // error
> }
> }
>
>
> I also had to add code to handle the origin and direction to the new Write
> method in the extended class (see previous message).
>
> Todd
>
>
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/mailman/listinfo/community
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20170309/0d633ada/attachment.html>


More information about the Community mailing list