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

Karthik Krishnan karthik.krishnan at kitware.com
Sun Apr 6 12:54:46 EDT 2008


The following declaration

   typedef const FixedImageType::Pointer *ImageFix;

should instead be

  typedef FixedImageType::ConstPointer ImageFix;

On Sun, Apr 6, 2008 at 10:17 AM, Boettcher, Dr. Peter
<Boettcher at kleintierklinik.uni-leipzig.de> wrote:
>
>
>
> 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 at
> 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.
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>


More information about the Insight-users mailing list