[Insight-users] declare global reader

john smith mkitkinsightuser at gmail.com
Wed Jun 1 11:11:25 EDT 2011


Hello, in my application I want to load my image once using a reader and
then use this reader every time I want to make image processing in the input
image.How could I declare this reader as global variable? I have tried many
things but I didn;t manafe to use reader as global variable. I would
appreciate your help.

*  typedef unsigned char        InputPixelType;
  typedef unsigned char        OutputPixelType;

  typedef itk::Image< InputPixelType,  3 >    InputImageType;
  typedef itk::Image< OutputPixelType, 2 >    OutputImageType;

  typedef itk::ImageFileReader< InputImageType  >  ReaderType;
  typedef itk::ImageFileWriter< OutputImageType >  WriterType;
ReaderType::Pointer reader = ReaderType::New();
 reader->SetFileName( fileName.toStdString()  );
      reader->Update();*


supposing that I have this function to load the reader
*
void MainWindow::push_button_File()
{

   fileName = QFileDialog::getOpenFileName(this,
                                   tr("Open File"), QDir::currentPath());

}*

and this function to use the reader

*void MainWindow::z_slice_extract()
{
  reader=.....
}*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110601/7f8a23da/attachment.htm>


More information about the Insight-users mailing list