[Insight-users] Public declaration of vtk and itk objects in MFC-applications

Boettcher, Dr. Peter Boettcher at kleintierklinik.uni-leipzig.de
Sun Apr 6 10:17:06 EDT 2008


Until now I used vtk for image analysis building MFC-applications. Now I would like to extend my code to both vtk and itk. 

 

I looked at the example from Yong Su <http://insight-journal.org/midas/search.php?authorfirst=Yong&authorlast=Su>  at http://insight-journal.org/midas/handle.php?handle=1926/479 <http://insight-journal.org/midas/handle.php?handle=1926/479>  but I still have the problem of declaring my variables

 

For vtk-objects I use this kind of code for public declaration

 

class CVtkKennethDlg : public CDialog

{

// Konstruktion

public:

            CVtkKennethDlg(CWnd* pParent = NULL); // Standard-Konstruktor

            vtkImageData * m_Image;

....}

 

in the main application I used

 

m_Image = vtkImageData::New();

 

 

 

Using this approach I declared m_Image for the rest of my code.

 

However I do not now how to implement that approach for itk-objects.

 

I tried the following which does not work:

 

 

class CDewarpDlg : public CDialog

{

// Konstruktion

public:

            CDewarpDlg(CWnd* pParent = NULL);       // Standard-Konstruktor

 

            typedef  float           PixelType;

            typedef itk::Image< PixelType, 2 >  FixedImageType;

            typedef const FixedImageType::Pointer *ImageFix;

...

}

 

 

 

in the main application :

 

void CDewarpDlg::OnBUTTONImgGrid() 

{

            // Loads the deformed Grid-image

            typedef itk::ImageFileReader< FixedImageType > ReaderType;

            ReaderType::Pointer reader = ReaderType::New();

            

            

            CString FileName;

            CFileDialog* m_fileDialog = new CFileDialog( TRUE, NULL, NULL, OFN_EXPLORER, "BMP Files (*.bmp)|*.bmp|All Files (*.*)|*.*||",  this );

 

            if(m_fileDialog->DoModal() == IDCANCEL) return;

            else FileName = m_fileDialog->GetPathName();

            delete m_fileDialog;

            

            

            reader->SetFileName( (LPCTSTR)FileName );

            reader->Update();

 

            ImageFix = FixedImageType::New();

            

            ImageFix = reader->GetOutput();

            

}

 

I got the following errors:

error C2513: 'const class itk::SmartPointer<class itk::Image<float,2> > *' : Keine Variable vor '=' deklariert

error C2513: 'const class itk::SmartPointer<class itk::Image<float,2> > *' : Keine Variable vor '=' deklariert

 

That means: no variable declared before '='

 

I think the problem is due to my very limited programming skills.

 

Regards, Peter.

 

PS: I would like to stick to MFC-based applications because I am familiar with that "platform". Switching to tcl or fltk would mean to start from the beginning.

 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20080406/93e0bf60/attachment-0001.htm>


More information about the Insight-users mailing list