<div>Hi Mattt,</div> <div>I followed your suggestions. In addition to that I have changed the pixel type at line no 94 (of the original example code) according to image format type (say for .bmp it is "typdef unsigned <STRONG>char</STRONG> PixelType;")</div> <div>The file locations for read and write have been added in both line 158 and 159, respectively.</div> <div>reader->SetFileName( "C:\\cygwin\\bin\\ImageReadWrite\\MRI_head_092.bmp" );<BR> writer->SetFileName( "C:\\cygwin\\bin\\ImageReadWrite\\MRI_head_092_w.bmp" );</div> <div>Now the program is reading and writing image files.</div> <div>Thanks to all insight users using this mail list. Special thanks to Matt for your prompt reply.</div> <div>Regards,</div> <div>Patra<BR><BR><B><I>att Kelsey <mkelsey@gmail.com></I></B> wrote:</div> <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff
2px solid">Hello KPatra,<BR>I think you will find that your message is due to the code on lines 59<BR>- 68 in ImageReadWrite.cxx, i.e.<BR>int main( int argc, char ** argv )<BR>{<BR>// Verify the number of parameters in the command line<BR>if( argc < 3 )<BR>{<BR>std::cerr << "Usage: " << std::endl;<BR>std::cerr << argv[0] << " inputImageFile outputImageFile " << std::endl;<BR>return EXIT_FAILURE;<BR>}<BR><BR>whereas the program checks that you have provided input and output<BR>file name. In your example you are providing these statically. You<BR>can either remove the code above requiring argc>=3 or just provide<BR>your image file name as command line parameters with the original<BR>example code. Good luck.<BR><BR>Matt<BR><BR>><BR>> ---------- Forwarded message ----------<BR>> From: karali patra <KPSR_IN@YAHOO.CO.IN><BR>> To: insight-users@itk.org<BR>> Date: Tue, 15 Jan 2008 03:46:22 +0000 (GMT)<BR>> Subject:
[Insight-users] Reading and writing image files using ITK and Cmake<BR>> Dear All,<BR>> I am a new user of ITK. I am trying to read and and write image files using the ITK and Cmakesetup (for configuring).I successfully run the helloWorld code(to test the itk is running properly).<BR>> I have copied the<BR>> Examples/IO/ImageReadWrite.cxx.<BR>> file to another directory "ImageReadWrite". I have created the following 'CMakeLists.txt' file in the same directory.<BR>><BR>> PROJECT(ImageReadWrite)<BR>> # Find ITK.<BR>> FIND_PACKAGE(ITK REQUIRED)<BR>> IF(ITK_FOUND)<BR>> INCLUDE(${ITK_USE_FILE})<BR>> ENDIF(ITK_FOUND)<BR>> ADD_EXECUTABLE(ImageReadWrite ImageReadWrite.cxx )<BR>> TARGET_LINK_LIBRARIES(ImageReadWrite ITKIO)<BR>> ......<BR>> I have modified the ImageReadWrite.cxx code in the following place<BR>><BR>> reader->SetFileName( "BrainProtonDensitySlice.png" );<BR>> writer->SetFileName(
"BrainProtonDensitySlice_w.png" );<BR>><BR>> I have also copied the image file "BrainProtonDensitySlice.png" to the same directory.<BR>><BR>> Now using the CMakeSetUp, I configured it (source and binary build directing are same). I got the ImageReadWrite.dsw workspace. I opened this in Visual Studio 6 and built all files successfully. I run the ImageReadWrite.exe file. It gave following output<BR>> "<BR>> usage:<BR>> C:\...\ImageReadWrite\Debug\ImageReadWrite.exe inputImageFile outputImageFile"<BR>><BR>> The program is not reading and writing the image. Please suggest what went wrong and help me correcting the problem<BR>> Thanks<BR>> KPatra<BR>> Singapore<BR>><BR>><BR>><BR></BLOCKQUOTE><BR><p> 
<!--2--><hr size=1></hr> Bring your gang together - do your thing. <a href="http://in.rd.yahoo.com/tagline_groups_2/*http://in.promos.yahoo.com/groups"> Start your group.</a>