<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<div>Dear ,</div>

<div>&nbsp;</div>

<div>could you please describe the problem you have with your code? The only things I see immediately is that you should write</div>

<div>&nbsp;</div>

<div><br/>
&nbsp; const char * outfile = &quot;C:&#92;&#92;Users&#92;&#92;zhq&#92;&#92;Desktop&#92;&#92;2.jpg&quot;;</div>

<div>&nbsp;</div>

<div>...</div>

<div>&nbsp;</div>

<div>write-&gt;SetImageIO(jpgIO);</div>

<div>
<div>&nbsp;</div>

<div>&nbsp;</div>

<div>&nbsp;</div>

<div>&nbsp;</div>

<div>&nbsp;</div>

<div>Best,</div>

<div>Robert</div>

<div>&nbsp;</div>

<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b>&nbsp;Mittwoch, 24. Juli 2013 um 10:31 Uhr<br/>
<b>Von:</b>&nbsp;&#31456;&#24378; &lt;15891495523@126.com&gt;<br/>
<b>An:</b>&nbsp;insight-users@itk.org<br/>
<b>Betreff:</b>&nbsp;[Insight-users] I want to fulfill a function with ITK , read from a dcm picture and write to a jpg picture .Please help !</div>

<div name="quoted-content">
<div style="line-height: 1.7;color: rgb(0,0,0);font-size: 14.0px;font-family: arial;">Hello , &nbsp; I have just started learning ITK , and I have some difficulty with it .
<div>&nbsp;Now &#65292;I want to fulfill a function with ITK , read from a dcm picture and write to a jpg picture . My code has some problem ,could you please correct it ? the following is my code :</div>

<div>
<div>&nbsp;</div>

<div>#include &quot;itkImageFileReader.h&quot;</div>

<div>#include &quot;itkImageFileWriter.h&quot;</div>

<div>#include &quot;itkRescaleIntensityImageFilter.h&quot;</div>

<div>#include &quot;itkGDCMImageIO.h&quot;</div>

<div>#include &quot;itkJPEGImageIO.h&quot;</div>

<div>&nbsp;</div>

<div>&nbsp;</div>

<div>void main( )</div>

<div>{</div>

<div>&nbsp; typedef signed short InputPixelType;</div>

<div>&nbsp; const unsigned int &nbsp; InputDimension = 2;</div>

<div>&nbsp;</div>

<div>&nbsp; typedef itk::Image&lt; InputPixelType, InputDimension &gt; InputImageType;</div>

<div>&nbsp;</div>

<div>&nbsp; typedef itk::ImageFileReader&lt; InputImageType &gt; ReaderType;</div>

<div>&nbsp;</div>

<div>&nbsp; ReaderType::Pointer reader = ReaderType::New();</div>

<div>&nbsp;</div>

<div>&nbsp; const char * filename = &quot;C:&#92;&#92;Users&#92;&#92;zhq&#92;&#92;Desktop&#92;&#92;data&#92;&#92;SNAP_CR&#92;&#92;E403434298&#92;&#92;E403434298S1901I301.dcm&quot;;</div>

<div>&nbsp;</div>

<div>&nbsp; reader-&gt;SetFileName( filename );</div>

<div>&nbsp;</div>

<div>&nbsp; typedef itk::GDCMImageIO &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ImageIOType;</div>

<div>&nbsp;</div>

<div>&nbsp; ImageIOType::Pointer gdcmImageIO = ImageIOType::New();</div>

<div>&nbsp;</div>

<div>&nbsp; reader-&gt;SetImageIO( gdcmImageIO );</div>

<div>&nbsp;</div>

<div>&nbsp; reader-&gt;Update();</div>

<div>&nbsp;</div>

<div>&nbsp; typedef itk::ImageFileWriter&lt;InputImageType&gt; &nbsp;WriteType ;</div>

<div>&nbsp;</div>

<div>&nbsp; WriteType::Pointer write = WriteType::New();</div>

<div>&nbsp;</div>

<div>&nbsp; const char * outfile = &quot;C:&#92;&#92;Users&#92;&#92;zhq&#92;&#92;Desktop&#92;&#92;2.dcm&quot;;</div>

<div>&nbsp;</div>

<div>&nbsp; write-&gt;SetFileName(outfile);</div>

<div>&nbsp;</div>

<div>&nbsp; typedef itk::JPEGImageIO &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;OutPutIOType ;&nbsp;</div>

<div>&nbsp;</div>

<div>&nbsp; OutPutIOType::Pointer jpgIO = OutPutIOType::New();</div>

<div>&nbsp;</div>

<div>&nbsp; write-&gt;SetImageIO(gdcmImageIO);</div>

<div>&nbsp;</div>

<div>&nbsp; write-&gt;SetInput(reader-&gt;GetOutput());</div>

<div>&nbsp;</div>

<div>&nbsp; write-&gt;Update();</div>

<div>}</div>
</div>
</div>
</div>
</div>
</div>
</div></div></body></html>