Hi, Lius,<br><br>
<div><span class="gmail_quote">2007/5/2, Luis Ibanez &lt;<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>&gt;:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><br>Hi Chris,<br><br>What exactly was changed in the image content (the pixel data) ?<br><br>Did the intensities of the pixels changed ?
</blockquote>
<div>&nbsp;</div>
<div><font color="#33ccff">---------------Yes, I changed the intensities of the pixels.</font></div><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">What was the pixel type of the original data ?</blockquote>
<div>&nbsp;</div>
<div><font color="#00cccc"><font color="#33ccff">---------------I didn&#39;t know the exactly pixel type of the original data, From it header infomation&nbsp;of &quot;(0028,0100) Bits Allocated<br>&nbsp;&nbsp;&nbsp; US&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp; 16&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;and&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot; (0028,0101) Bits Stored&nbsp;&nbsp;&nbsp; US&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp; 12&quot;&nbsp;, I think it may be 16-bits.&nbsp; Is it unsigned short??. 
</font></font></div>
<div><font color="#00cccc"><font color="#33ccff"></font></font>&nbsp;</div><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">What was the pixel type that you used for<br>instantiating the itk::Image&lt;&gt; in your code ?</blockquote>

<div>&nbsp;</div>
<div>&nbsp;</div><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">If you instantiate the image using the correct pixel type,<br>then the values should not change.<br><br>What tool are you using for looking at the DICOM image
<br>pixel data ?</blockquote>
<div>&nbsp;</div>
<div>
<div><font color="#33ccff">--------------------Actualy&nbsp;I used the filter work-flow described in the example &quot;CurvesLevelSet&quot;. </font></div>
<div><font color="#666600">typedef itk::Image&lt; float,&nbsp;2 &gt;&nbsp; InputImageType;</font></div>
<div>
<div><font color="#666600">typedef itk::Image&lt; unsigned char,&nbsp;2 &gt;&nbsp; OutputImageType;</font></div>
<div><font color="#666600"></font>&nbsp;</div>
<div><font color="#666600">typedef itk::BinaryThresholdImageFilter&lt;&nbsp;&nbsp;&nbsp;&nbsp;InputImageType,&nbsp;&nbsp;OutputImageType&nbsp;&nbsp;&nbsp; &gt;&nbsp;&nbsp;&nbsp; ThresholdingFilterType;</font></div>
<div><font color="#666600">ThresholdingFilterType::Pointer thresholder = ThresholdingFilterType::New();</font></div>
<div>
<p><font color="#666600">&nbsp;typedef&nbsp; itk::ImageFileReader&lt; InternalImageType &gt; ReaderType;<br>&nbsp;typedef&nbsp; itk::ImageFileWriter&lt;&nbsp; OutputImageType&nbsp; &gt; WriterType;</font></p>
<p><font color="#666600">&nbsp;ReaderType::Pointer reader = ReaderType::New();<br>&nbsp;WriterType::Pointer writer = WriterType::New();</font></p>
<p><font color="#666600">&nbsp;reader-&gt;SetFileName( argv[1] );<br>&nbsp;reader-&gt;SetImageIO( gdcmIO );<br>&nbsp;writer-&gt;SetFileName( argv[2] );&nbsp;<br>&nbsp;//writer-&gt;SetImageIO( gdcmIO );</font></p>
<p><font color="#666600">............. // filter and process</font></p>
<p><font color="#666600">///--------------------I use this to make the output images&#39;dicom image header</font></p>
<p><font color="#666600">&nbsp;typedef itk::MetaDataDictionary DictionaryType;<br>&nbsp;DictionaryType &amp; dictionary = gdcmIO-&gt;GetMetaDataDictionary();</font></p>
<p><br><font color="#666600">&nbsp;typedef itk::MetaDataObject&lt; std::string &gt; MetaDataStringType;<br>&nbsp;DictionaryType::ConstIterator itr = dictionary.Begin();<br>&nbsp;DictionaryType::ConstIterator end = dictionary.End();</font>
</p>
<p><font color="#666600">&nbsp;while( itr != end )<br>&nbsp;{<br>&nbsp;&nbsp;itk::MetaDataObjectBase::Pointer entry = itr-&gt;second;<br>&nbsp;&nbsp;MetaDataStringType::Pointer entryvalue =<br>&nbsp;&nbsp;&nbsp;dynamic_cast&lt;MetaDataStringType *&gt;( entry.GetPointer
() ) ;<br>&nbsp;&nbsp;if( entryvalue )<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;std::string tagkey = itr-&gt;first;<br>&nbsp;&nbsp;&nbsp;std::string labelId;<br>&nbsp;&nbsp;&nbsp;bool found = itk::GDCMImageIO::GetLabelFromTag( tagkey, labelId );<br>&nbsp;&nbsp;&nbsp;std::string tagvalue = entryvalue-&gt;GetMetaDataObjectValue();
<br>&nbsp;&nbsp;&nbsp;itk::EncapsulateMetaData&lt;std::string&gt;( dictionary, labelId, tagvalue );</font></p>
<p><font color="#666600">&nbsp;&nbsp;&nbsp;if( found )<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;std::cout &lt;&lt; &quot;(&quot; &lt;&lt; tagkey &lt;&lt; &quot;) &quot; &lt;&lt; labelId;<br>&nbsp;&nbsp;&nbsp;&nbsp;std::cout &lt;&lt; &quot; = &quot; &lt;&lt; tagvalue.c_str() &lt;&lt; std::endl;
<br>&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;// Software Guide : EndCodeSnippet<br>&nbsp;&nbsp;&nbsp;else<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;std::cout &lt;&lt; &quot;(&quot; &lt;&lt; tagkey &lt;&lt;&nbsp; &quot;) &quot; &lt;&lt; &quot;Unknown&quot;;<br>&nbsp;&nbsp;&nbsp;&nbsp;std::cout &lt;&lt; &quot; = &quot; &lt;&lt; 
tagvalue.c_str() &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;}<br>&nbsp;&nbsp;<br>&nbsp;&nbsp;++itr;<br>&nbsp;}</font></p>
<p><font color="#666600">//-------------------header infomation end</font></p>
<p><font color="#666600">&nbsp;thresholder-&gt;SetInput( geodesicActiveContour-&gt;GetOutput() );<br>&nbsp;writer-&gt;SetInput( thresholder-&gt;GetOutput() );</font></p></div>
<div><font color="#33ccff">Is it right? The problem exist the data type change from float to unsighed char??</font></div>
<div>&nbsp;</div>
<div>
<div><font color="#33ccff"></font>&nbsp;</div></div>
<div><font color="#33ccff"></font>&nbsp;</div>
<div>&nbsp;</div></div></div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">&nbsp;&nbsp;Please let us know,<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;Thanks<br><br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Luis<br><br><br><br>------------------<br>
Chris Lee wrote:<br>&gt; Hi, itkers,<br>&gt;<br>&gt; I need help about the problem how to save a dicom file after processing<br>&gt; with its orginal header infomation.<br>&gt; In detail, I filter and segment a dicom image file, for example, CT image,
<br>&gt; and I want the result file can be saved in the format of dicom and with<br>&gt; the same header infomation( including image position, instance number<br>&gt; and so on ).<br>&gt;<br>&gt; I learned from the example &quot;DicomImageReadChangeHeaderWrite&quot;,.
<br>&gt; However, when I run this example, I made the paramaters Entry as &quot;<br>&gt; 0020|0013&quot;, Value as &quot;7&quot;.<br>&gt; As a result, I found the output dicom image file with the correct<br>&gt; Instance Number as 7, and the image content (the pixel data) was changed.
<br>&gt;<br>&gt; Did I misunderstand this example?<br>&gt; And if I want to achive my goal as the title said, what can I do?<br>&gt;<br>&gt; Thank you.<br>&gt;<br>&gt; --<br>&gt; Best wishes,<br>&gt; Chris<br>&gt;<br>&gt;
<br>&gt; ------------------------------------------------------------------------<br>&gt;<br>&gt; _______________________________________________<br>&gt; Insight-users mailing list<br>&gt; <a href="mailto:Insight-users@itk.org">
Insight-users@itk.org</a><br>&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a><br></blockquote></div><br><br clear="all"><br>-- <br>Best wishes,<br>Chris