[Insight-users] using reader as global variable

john smith mkitkinsightuser at gmail.com
Mon May 30 05:25:41 EDT 2011


I am using Qt add in for visual studio 2010 and I have typed this. But still
gettting these errors:
*1>e:\qt
applications\mainwindow_globalreader\mainwindow\mainwindow\mainwindow.h(49):
error C2065: 'ImageType' : undeclared identifier
1>e:\qt
applications\mainwindow_globalreader\mainwindow\mainwindow\mainwindow.h(50):
error C2955: 'itk::ImageFileReader' : use of class template requires
template argument list
1>          c:\itk\source\code\io\itkImageFileReader.h(93) : see declaration
of 'itk::ImageFileReader'
1>e:\qt
applications\mainwindow_globalreader\mainwindow\mainwindow\mainwindow.h(50):
fatal error C1903: unable to recover from previous error(s); stopping
compilation
1>  mainwindow.cpp*

I have include the header fules "itkImage.h" ,"itkImageFileReader.h".Could
somebody help me?

class MainWindow : public QMainWindow
{
  ..............

private:
typedef   itk::ImageFileReader< ImageType >   ReaderType;
ReaderType::Pointer reader;

};


MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
............
...........
      typedef unsigned char        InputPixelType;
  typedef itk::Image< InputPixelType,  3 >    InputImageType;
  typedef itk::ImageFileReader< InputImageType  >  ReaderType;
  ReaderType::Pointer reader = ReaderType::New();

}


2011/5/30 David Doria <daviddoria at gmail.com>

> On Sun, May 29, 2011 at 7:21 PM, john smith <mkitkinsightuser at gmail.com>wrote:
>
>> To be more specific I have tried the following, but still I get errors.
>> Could somebody tell me what to type?
>>
>> Thanks in advance
>>
>>  class MainWindow
>> {
>> private:
>>  typedef   itk::ImageFileReader< ImageType >   ReaderType;
>>
>> };
>>
>
void MainWindow::push_button_File()
{

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

  reader->SetFileName( fileName.toStdString()  );
  reader->Update();
}


>
>>
>>
>> MainWindow::MainWindow()
>> {
>>   reader = ReaderType::New();
>> }
>>
>
> Now you have defined the type, but not created the variable.  You need:
>
> typedef   itk::ImageFileReader< ImageType >   ReaderType;
> ReaderType::Pointer reader;
>
> in the class.
>
> David
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110530/112c6d54/attachment.htm>


More information about the Insight-users mailing list