<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<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> Mittwoch, 24. Juli 2013 um 11:23 Uhr<br/>
<b>Von:</b> 章强 <15891495523@126.com><br/>
<b>An:</b> "Robert Haase" <robert_haase@gmx.de><br/>
<b>Betreff:</b> Re:Aw: [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;">Dear:
<div> Thank you for your reply
<div> I am sorry , the problem you pointed out is due to my carelessness . </div>
<div> some errors in my code should be corrected are :</div>
<div> const char * outfile = "C:\\Users\\zhq\\Desktop\\2.jpg";</div>
<div> writer->SetImageIO( jpgIO );</div>
<div> when I run the program , the result is :</div>
<div><img src="cid:77fc34db$1$1400ffd4049$Coremail$15891495523$126.com"/><br/>
<br/>
<br/>
<br/>
<div> </div>
<div id="divNeteaseMailCard"> </div>
<br/>
At 2013-07-24 17:11:28,"Robert Haase" <robert_haase@gmx.de> wrote:
<blockquote id="isReplyContent" style="PADDING-LEFT: 1.0ex;MARGIN: 0.0px 0.0px 0.0px 0.8ex;BORDER-LEFT: rgb(204,204,204) 1.0px solid;">
<div style="font-family: Verdana;font-size: 12.0px;">
<div>
<div>Dear ,</div>
<div> </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> </div>
<div><br/>
const char * outfile = "C:\\Users\\zhq\\Desktop\\2.jpg";</div>
<div> </div>
<div>...</div>
<div> </div>
<div>write->SetImageIO(jpgIO);</div>
<div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div>Best,</div>
<div>Robert</div>
<div> </div>
<div style="margin: 10.0px 5.0px 5.0px 10.0px;padding: 10.0px 0 10.0px 10.0px;border-left: 2.0px solid rgb(195,217,229);">
<div style="margin: 0 0 10.0px 0;"><b>Gesendet:</b> Mittwoch, 24. Juli 2013 um 10:31 Uhr<br/>
<b>Von:</b> 章强 <<a href="15891495523@126.com" target="_parent">15891495523@126.com</a>><br/>
<b>An:</b> <a href="insight-users@itk.org" target="_parent">insight-users@itk.org</a><br/>
<b>Betreff:</b> [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>
<div style="line-height: 1.7;color: rgb(0,0,0);font-size: 14.0px;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> </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> </div>
<div> </div>
<div>void main( )</div>
<div>{</div>
<div> typedef signed short InputPixelType;</div>
<div> const unsigned int InputDimension = 2;</div>
<div> </div>
<div> typedef itk::Image< InputPixelType, InputDimension > InputImageType;</div>
<div> </div>
<div> typedef itk::ImageFileReader< InputImageType > ReaderType;</div>
<div> </div>
<div> ReaderType::Pointer reader = ReaderType::New();</div>
<div> </div>
<div> const char * filename = "C:\\Users\\zhq\\Desktop\\data\\SNAP_CR\\E403434298\\E403434298S1901I301.dcm";</div>
<div> </div>
<div> reader->SetFileName( filename );</div>
<div> </div>
<div> typedef itk::GDCMImageIO ImageIOType;</div>
<div> </div>
<div> ImageIOType::Pointer gdcmImageIO = ImageIOType::New();</div>
<div> </div>
<div> reader->SetImageIO( gdcmImageIO );</div>
<div> </div>
<div> reader->Update();</div>
<div> </div>
<div> typedef itk::ImageFileWriter<InputImageType> WriteType ;</div>
<div> </div>
<div> WriteType::Pointer write = WriteType::New();</div>
<div> </div>
<div> const char * outfile = "C:\\Users\\zhq\\Desktop\\2.dcm";</div>
<div> </div>
<div> write->SetFileName(outfile);</div>
<div> </div>
<div> typedef itk::JPEGImageIO OutPutIOType ; </div>
<div> </div>
<div> OutPutIOType::Pointer jpgIO = OutPutIOType::New();</div>
<div> </div>
<div> write->SetImageIO(gdcmImageIO);</div>
<div> </div>
<div> write->SetInput(reader->GetOutput());</div>
<div> </div>
<div> write->Update();</div>
<div>}</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</div></div></body></html>