[Insight-users] raw files output directory

Luis Ibanez luis.ibanez at kitware.com
Tue, 27 Jan 2004 22:12:32 -0500


Hi Nasser,

You can append the directory name to the
filenames used for writing the fixed, moving
and registered images.



Please go to the file:

   InsightApplications/
       MultiResMIRegistration/
                        Common/
                           SimpleAppOutput.cxx


and in lines 92 to 104 you will find:

> 
>     fixedWriter->SetInput( m_FixedImage );
>     fixedWriter->SetFileName( "FixedImage.mhd" );
>     fixedWriter->Update();
> 
>     movingwriter->SetInput( m_MovingImage );
>     movingwriter->SetFileName( "MovingImage.mhd" );
>     movingwriter->Update();
> 
>     resampleMovingwriter->SetInput( m_ResampledImage );
>     resampleMovingwriter->SetFileName( "ResampledMovingImage.mhd" );
>     resampleMovingwriter->Update();

change these lines to be:


   std::string filename;

   fixedWriter->SetInput( m_FixedImage );
   filename = m_Directory + "FixedImage.mhd";
   fixedWriter->SetFileName( filename.c_str() );
   fixedWriter->Update();

   movingwriter->SetInput( m_MovingImage );
   filename = m_Directory + "MovingImage.mhd";
   movingwriter->SetFileName( filename.c_str() );
   movingwriter->Update();

   resampleMovingwriter->SetInput( m_ResampledImage );
   filename = m_Directory + "ResampledImage.mhd";
   resampleMovingwriter->SetFileName( filename.c_str() );
   resampleMovingwriter->Update();


Then recompile the application.


Note that he directory must exists before you
run this application. The directory string is
read from the parameter file, so you don't
need to initialize it in your code.


You don't need to make any changes in the
ImageFileWriter.txx file.



Please let us know if you find any problems.


Thanks,



    Luis





------------------------
Nasser Kashou wrote:

> Hello,
> 
> I've been using and older version of ITK source code for MultiResMIReg and all my output pgms were directed to the output directory, but now I'm using a newer version that I had for a while and it outputs raw  files but  to the root directory and not to the output directory written in the param file.
> I tried to add m_DirectoryName(""),  to the file itkImageFileWriter.txx and some minor changes.  I got an file.mhd to output to the relevant dir, but of size 0.  
> So my question is what is  a quick fix to using the raw file results but outputing them to a different dir than the root?
> Note. I don't have the most recent source code.
> 
> template <class TInputImage>
> ImageFileWriter<TInputImage>
> ::ImageFileWriter():
>   m_DirectoryName(""), //*********ADDED
>   m_FileName(""),
>   m_ImageIO(0), m_UserSpecifiedImageIO(false),
>   m_UserSpecifiedIORegion(false)
> {
> 	
> } 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>