<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial">Hello , I have just started learning ITK , and I have some difficulty with it .<div> Now ,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><br></div><div>#include "itkImageFileReader.h"</div><div>#include "itkImageFileWriter.h"</div><div>#include "itkRescaleIntensityImageFilter.h"</div><div>#include "itkGDCMImageIO.h"</div><div>#include "itkJPEGImageIO.h"</div><div><br></div><div><br></div><div>void main( )</div><div>{</div><div> typedef signed short InputPixelType;</div><div> const unsigned int InputDimension = 2;</div><div><br></div><div> typedef itk::Image< InputPixelType, InputDimension > InputImageType;</div><div><br></div><div> typedef itk::ImageFileReader< InputImageType > ReaderType;</div><div><br></div><div> ReaderType::Pointer reader = ReaderType::New();</div><div><br></div><div> const char * filename = "C:\\Users\\zhq\\Desktop\\data\\SNAP_CR\\E403434298\\E403434298S1901I301.dcm";</div><div><br></div><div> reader->SetFileName( filename );</div><div><br></div><div> typedef itk::GDCMImageIO ImageIOType;</div><div><br></div><div> ImageIOType::Pointer gdcmImageIO = ImageIOType::New();</div><div><br></div><div> reader->SetImageIO( gdcmImageIO );</div><div><span class="Apple-tab-span" style="white-space: pre; "> </span></div><div> reader->Update();</div><div><br></div><div> typedef itk::ImageFileWriter<InputImageType> WriteType ;</div><div><br></div><div> WriteType::Pointer write = WriteType::New();</div><div><br></div><div> const char * outfile = "C:\\Users\\zhq\\Desktop\\2.dcm";</div><div><br></div><div> write->SetFileName(outfile);</div><div><br></div><div> typedef itk::JPEGImageIO OutPutIOType ; </div><div><br></div><div> OutPutIOType::Pointer jpgIO = OutPutIOType::New();</div><div><br></div><div> write->SetImageIO(gdcmImageIO);</div><div><br></div><div> write->SetInput(reader->GetOutput());</div><div><br></div><div> write->Update();</div><div>}</div></div></div>