<div>Hi,</div> <div>For testing teh impulse response of some function I need to create an n*n image with zeros in in except for the central pixel which is supposed to be 1. Assuming I can correctly acomplish that (see teh code below), how do I write the dynamically allocated image using <FONT size=2>itk::ImageFileWriter ?</FONT></div> <div><FONT size=2></FONT> </div> <div><FONT size=2>Thank you very much, </FONT></div> <div><FONT size=2>Shlomo Kashani. </FONT></div> <div><FONT size=2></FONT> </div> <div>...</div><FONT size=2><FONT color=#0000ff size=2> <div>typedef</FONT><FONT size=2> itk::Image<</FONT><FONT color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>short</FONT><FONT size=2>,2> ImageType2D;</div> <div></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> itk::ImageFileReader<ImageType2D> ReaderType;</div> <div></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2>
itk::ImageFileWriter< ImageType2D > WriterType;</div> <div></FONT><FONT color=#008000 size=2>// create a new image </div></FONT><FONT size=2> <div>ImageType2D::Pointer smallImage = ImageType2D::New();</div> <div></div> <div></FONT><FONT color=#008000 size=2>// define the size of the image </div></FONT><FONT size=2> <div>ImageType2D::SizeType size;</div> <div>size[0] = 50; </FONT><FONT color=#008000 size=2>// size along X</div></FONT><FONT size=2> <div>size[1] = 50; </FONT><FONT color=#008000 size=2>// size along Y</div></FONT><FONT size=2> <div></FONT><FONT color=#008000 size=2>// define the starting position of the image </div></FONT><FONT size=2> <div>ImageType2D::IndexType start;</div> <div>start[0] = 0; </FONT><FONT color=#008000 size=2>// first index on X</div></FONT><FONT size=2> <div>start[1] = 0; </FONT><FONT color=#008000 size=2>// first index on Y</div></FONT><FONT size=2> <div></div> <div></FONT><FONT color=#008000 size=2>// define a region
using the starting position and size </div></FONT><FONT size=2> <div></FONT><FONT color=#008000 size=2>// declared earlier </div></FONT><FONT size=2> <div>ImageType2D::RegionType region;</div> <div>region.SetSize( size );</div> <div>region.SetIndex( start );</div> <div></FONT><FONT color=#008000 size=2>// set the region to be processed</div></FONT><FONT size=2> <div>smallImage->SetRegions( region );</div> <div></FONT><FONT color=#008000 size=2>// allocate memory for the region</div></FONT><FONT size=2> <div>smallImage->Allocate();</div> <div>// write the pixles</div> <div>...</div> <div>....</div> <div></FONT><FONT color=#008000 size=2>// create new image reader, NOT sure if I need that </div></FONT><FONT size=2> <div>ReaderType::Pointer reader = ReaderType::New();</div> <div></FONT><FONT color=#008000 size=2>// create new image writer</div></FONT><FONT size=2> <div>WriterType::Pointer writer = WriterType::New();</div> <div></div></FONT>
<div></FONT> </div> <div>//How do I use the writer to persist smallimage ?</div> <div> </div> <div> </div><p> 
                <hr size=1><a href="http://us.rd.yahoo.com/mail_us/taglines/postman3/*http://us.rd.yahoo.com/evt=39666/*http://messenger.yahoo.com">Yahoo! Messenger with Voice.</a> PC-to-Phone calls for ridiculously low rates.