Dear Mathieu,<br><br>>> your image: has no dimension, is not allocated, and is not<br>>> initialized. If you compiler previously allowed you to write such an<br>
>> image, well... it's *really* a broken compiler.<br><br>Thank you for pointing out the error. I am sorry for these mistakes.<br>I got rid of that exception now; the modified code is looking as shown below.<br>
But still there is one more problem:<br>
<br>The RTSTRUCT file created now is containing some unwanted tags that are<br>related to the Image-Pixel module, like rows(tag <0028,0010>) and columns(tag<0028,0010>).<br>Since RTSTRUCT file does not contain Pixel-module and these tags, I want to remove them.<br>
<br><span style="color: rgb(255, 0, 0);">1. Is there any way in ITK to remove a specific tag from the DICOM file?</span><br style="color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);"> Or, is there any way to tell the ITK writer, not to write a particular tag into the output DICOM file?<br>
</span><br>The current code is looking as shown below:<br><br><span style="color: rgb(0, 0, 153);">typedef itk::Image< signed short, 2 > Image2DType;</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">Image2DType::Pointer dummyImage = Image2DType::New();</span><br style="color: rgb(0, 0, 153);">
<br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">Image2DType::IndexType start;</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">start[0] = 0; start[1] = 0;</span><br style="color: rgb(0, 0, 153);">
<br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">Image2DType::SizeType imageSize;</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">imageSize[0] = 100; imageSize[1] = 100;</span><br style="color: rgb(0, 0, 153);">
<br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">Image2DType::RegionType region;</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">region.SetSize(imageSize);</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">region.SetIndex(start);</span><br style="color: rgb(0, 0, 153);"><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">dummyImage->SetRegions(region);</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">dummyImage->Allocate();</span><br style="color: rgb(0, 0, 153);"><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">Image2DType::PixelType initialValue = 0;</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">dummyImage->FillBuffer( initialValue );</span><br style="color: rgb(0, 0, 153);"><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">writer->SetFileName( outputFileName );</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">writer->SetImageIO( gdcmImageIO );</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">writer->UseInputMetaDataDictionaryOff ();</span><br style="color: rgb(0, 0, 153);">
<br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">itk::MetaDataDictionary & dictWriter = gdcmImageIO->GetMetaDataDictionary();</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);"> </span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">// Study Instance UID</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">string tagID = "0020|000D";</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">string tagValue = "1.2.840.113619.2.55.3.464283444.427.1208496883.209";</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">itk::EncapsulateMetaData<string>(dictWriter, tagID, tagValue);</span><br style="color: rgb(0, 0, 153);"><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">writer->Update();</span><br>
<br>>> If this is 2D ROIs mask, simply use marching cube to generated the contour.<br>>> This will be very fast and very robust.<br><br>Thank you for this information.<br><span style="color: rgb(255, 0, 0);">Actually the image is in 3-D</span><br style="color: rgb(255, 0, 0);">
<span style="color: rgb(255, 0, 0);">BUT as the ROIs will be written in 2-D axial slice-wise direction in the RTSTRUCT,</span><br style="color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);">can I apply the marching cube algorithm slice-by-slice, for obtaining the respective 2-D contours?</span><br>
<br><br>>> "0.0.0" is not a valid root UID. Did you use dicom3tools at any point in the process ?<br><br>I was not knowing this previously. Thank you very much.<br><br>Thank you very much for your help.<br>
<br>Warm Regards,<br>Subrahmanyam Gorthi.<br><br>
<br><br><br><br><br><div class="gmail_quote">On Thu, Jul 3, 2008 at 11:03 AM, Mathieu Malaterre <<a href="mailto:mathieu.malaterre@gmail.com" target="_blank">mathieu.malaterre@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Subrahmanyam,<br>
<br>
On Wed, Jul 2, 2008 at 9:44 PM, Subrahmanyam Gorthi<br>
<div><<a href="mailto:subrahmanyam.gorthi@gmail.com" target="_blank">subrahmanyam.gorthi@gmail.com</a>> wrote:<br>
> Dear Mathieu,<br>
><br>
</div><div>> Thank you very much for your reply.<br>
><br>
>>> Is this integrated with any of the Mesh and/or the Meta Object in ITK too<br>
>>> ?<br>
><br>
> Currently, at the end of my segmentation in ITK, I have ROIs in mask format.<br>
> I still have to work on converting this mask to a polygon so that in can be<br>
> written to a ROI module.<br>
<br>
</div>If this is 2D ROIs mask, simply use marching cube to generated the<br>
contour. This will be very fast and very robust.<br>
<div><br>
> Because of my little exposure to ITK, I am not aware whether this conversion<br>
> involves Mesh or Meta Objects.<br>
<br>
</div>Forget what I said about Spatial objects, those are not meant for<br>
this. I think most segmentation algorithm will return an itk::Mesh.<br>
Using itk::Mesh should be fine.<br>
<div><br>
> I am facing problem while calling the KeepOriginalUIDOn ().<br>
> A runtime exception is thrown when the above function is called.<br>
> I am afraid there is some error in the way I am using the ImageFileWriter,<br>
> since the error is occurring while updating the writer.<br>
> To reproduce the problem, I have created a sample code.<br>
> Please find attached the .cxx & the associated CMakeLists.txt files.<br>
> Can you please help me?<br>
<br>
</div>You cannot do this:<br>
<br>
...<br>
ImageType::Pointer dummyImage = ImageType::New();<br>
<br>
writer->SetFileName( outputFileName );<br>
writer->SetInput( dummyImage );<br>
<br>
writer->SetImageIO( gdcmImageIO );<br>
...<br>
<br>
your image: has no dimension, is not allocated, and is not<br>
initialized. If you compiler previously allowed you to write such an<br>
image, well... it's *really* a broken compiler.<br>
<div><br>
<br>
<br>
> Thank you for the details on the possible pipeline for the RTSTRUCT, which<br>
> is more flexible and general.<br>
> I will give a try part by part.<br>
<br>
</div>As a side note you cannot do that either:<br>
<br>
string tagValue = "0.0.0.0.2.8811.20010413115754.12432";<br>
<br>
"<a href="http://0.0.0.0" target="_blank">0.0.0.0</a>" is not a valid root UID. Did you use dicom3tools at any<br>
point in the process ? If so please check the README file in the<br>
source tree, explaining how to compile it and set your own root UID.<br>
<br>
HTH<br>
--<br>
<font color="#888888">Mathieu<br>
</font></blockquote></div><br>