[Insight-users] Problem in copying DICOM image: Study instance UID value is changed

Subrahmanyam Gorthi subrahmanyam.gorthi at gmail.com
Thu Jul 3 10:51:43 EDT 2008


Dear Mathieu,

>> your image: has no dimension, is not allocated, and is not
>> initialized. If you compiler previously allowed you to write such an
>> image, well... it's *really* a broken compiler.

Thank you for pointing out the error. I am sorry for these mistakes.
I got rid of that exception now; the modified code is looking as shown
below.
But still there is one more problem:

The RTSTRUCT file created now is containing some unwanted tags that are
related to the Image-Pixel module, like rows(tag <0028,0010>) and
columns(tag<0028,0010>).
Since RTSTRUCT file does not contain Pixel-module and these tags, I want to
remove them.

1. Is there any way in ITK to remove a specific tag from the DICOM file?
   Or, is there any way to tell the ITK writer, not to write a particular
tag into the output DICOM file?

The current code is looking as shown below:

typedef itk::Image< signed short, 2 > Image2DType;
Image2DType::Pointer dummyImage = Image2DType::New();

Image2DType::IndexType start;
start[0] = 0; start[1] = 0;

Image2DType::SizeType imageSize;
imageSize[0] = 100; imageSize[1] = 100;

Image2DType::RegionType region;
region.SetSize(imageSize);
region.SetIndex(start);

dummyImage->SetRegions(region);
dummyImage->Allocate();

Image2DType::PixelType  initialValue = 0;
dummyImage->FillBuffer( initialValue );

writer->SetFileName( outputFileName );
writer->SetImageIO( gdcmImageIO );
writer->UseInputMetaDataDictionaryOff ();

itk::MetaDataDictionary & dictWriter = gdcmImageIO->GetMetaDataDictionary();

// Study Instance UID
string tagID    = "0020|000D";
string tagValue = "1.2.840.113619.2.55.3.464283444.427.1208496883.209";
itk::EncapsulateMetaData<string>(dictWriter, tagID, tagValue);

writer->Update();

>> If this is 2D ROIs mask, simply use marching cube to generated the
contour.
>> This will be very fast and very robust.

Thank you for this information.
Actually the image is in 3-D
BUT as the ROIs will be written in 2-D axial slice-wise direction in the
RTSTRUCT,
can I apply the marching cube algorithm slice-by-slice, for obtaining the
respective 2-D contours?


>> "0.0.0" is not a valid root UID. Did you use dicom3tools at any point in
the process ?

I was not knowing this previously. Thank you very much.

Thank you very much for your help.

Warm Regards,
Subrahmanyam Gorthi.






On Thu, Jul 3, 2008 at 11:03 AM, Mathieu Malaterre <
mathieu.malaterre at gmail.com> wrote:

> Subrahmanyam,
>
> On Wed, Jul 2, 2008 at 9:44 PM, Subrahmanyam Gorthi
> <subrahmanyam.gorthi at gmail.com> wrote:
> > Dear Mathieu,
> >
> > Thank you very much for your reply.
> >
> >>> Is this integrated with any of the Mesh and/or the Meta Object in ITK
> too
> >>> ?
> >
> > Currently, at the end of my segmentation in ITK, I have ROIs in mask
> format.
> > I still have to work on converting this mask to a polygon so that in can
> be
> > written to a ROI module.
>
> If this is 2D ROIs mask, simply use marching cube to generated the
> contour. This will be very fast and very robust.
>
> > Because of my little exposure to ITK, I am not aware whether this
> conversion
> > involves Mesh or Meta Objects.
>
> Forget what I said about Spatial objects, those are not meant for
> this. I think most segmentation algorithm will return an itk::Mesh.
> Using itk::Mesh should be fine.
>
> > I am facing problem while calling the KeepOriginalUIDOn ().
> > A runtime exception is thrown when the above function is called.
> > I am afraid there is some error in the way I am using the
> ImageFileWriter,
> > since the error is occurring while updating the writer.
> > To reproduce the problem, I have created a sample code.
> > Please find attached the .cxx & the associated CMakeLists.txt files.
> > Can you please help me?
>
> You cannot do this:
>
> ...
>  ImageType::Pointer dummyImage = ImageType::New();
>
>  writer->SetFileName( outputFileName );
>  writer->SetInput( dummyImage );
>
>  writer->SetImageIO( gdcmImageIO );
> ...
>
>  your image: has no dimension, is not allocated, and is not
> initialized. If you compiler previously allowed you to write such an
> image, well... it's *really* a broken compiler.
>
>
>
> > Thank you for the details on the possible pipeline for the RTSTRUCT,
> which
> > is more flexible and general.
> > I will give a try part by part.
>
> As a side note you cannot do that either:
>
>  string tagValue = "0.0.0.0.2.8811.20010413115754.12432";
>
> "0.0.0.0" is not a valid root UID. Did you use dicom3tools at any
> point in the process ? If so please check the README file in the
> source tree, explaining how to compile it and set your own root UID.
>
> HTH
> --
> Mathieu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20080703/84d4b050/attachment-0001.htm>


More information about the Insight-users mailing list