[Insight-users] Re: VtkFltk in InsightApplications

Luis Ibanez luis . ibanez at kitware . com
Mon, 09 Jun 2003 20:30:33 -0400


HI Zhao,

Thanks for pointing this out.

There was actually an error in lines 19-20
of fltkVTKImageViewer.h

The SmartPointer<> declarations were missing
their itk:: namespace.

A fix has been commited in CVS.
http://www . itk . org/cgi-bin/cvsweb . cgi/InsightApplications/Auxiliary/VtkFltk/fltkVTKImageViewer . h . diff?r1=1 . 4&r2=1 . 5&cvsroot=Insight&sortby=date

---

On the other hand, please not that this
class is assuming that your input image
will be 3D.  The fltkVTKImageViewer is
a simple skeleton for setting up volume
rendering for segmented data.

Loading a single DICOM 2D slice will not
match the expected input image. Please
try loading a full volume.  You may
want to create a MetaImage header for your
data, or use MRIConvert for generating
a full MetaImage from your DICOM slices.



Regards,


    Luis



---------------------------------------
zhao yong qiang wrote:
> Hi,
> 
>     I write the following code to use fltkVTKImageViewer 
> (InsightApplications/Auxiliary/vtkFltk)to show image:
> 
>  
> 
> #include "itkImage.h"
> 
> #include "itkDICOMImageIO2.h"
> 
> #include "itkImageFileReader.h"
> 
> #include "itkDICOMImageIO2Factory.h"
> 
>  
> 
> #include "fltkVTKImageViewer.h"
> 
>  
> 
> #include <config.h>
> 
> #include <FL/Fl.H>
> 
>  
> 
> int main(int argc, char **argv)
> 
> {
> 
>          typedef float InputPixelType;
> 
>          const unsigned int Dimension = 2;
> 
>          typedef itk::Image< InputPixelType, Dimension >  InputImageType;
> 
>  
> 
>          
> itk::ObjectFactoryBase::RegisterFactory(itk::DICOMImageIO2Factory::New()); 
> 
>        itk::DICOMImageIO2::Pointer DICOMImage =
> 
>                      itk::DICOMImageIO2::New();
> 
>  
> 
>          itk::ImageFileReader<InputImageType>::Pointer fileReader  =
> 
>                      itk::ImageFileReader<InputImageType>::New();
> 
>  
> 
>             fileReader->SetImageIO(DICOMImage);
> 
>             fileReader->SetFileName("f:\\test\\t1.dcm");
> 
>             fileReader->UpdateLargestPossibleRegion();
> 
>  
> 
>          typedef fltk::VTKImageViewer<InputImageType::PixelType>  ImageViewer;
> 
>          ImageViewer::Pointer viewer = ImageViewer::New();           
> 
>           viewer->SetImage(fileReader->GetOutput());
> 
>           viewer->Show();
> 
>  
> 
>          Fl::run();
> 
>          return 0;
> 
> }
> 
>  
> 
> it showed such mistake:
> 
> E:\P609\fltkVTKImageViewer.h(49) : error C2143: syntax error : missing 
> ';' before '<'
> 
>         E:\P609\fltkVTKImageViewer.h(89) : see reference to class 
> template instantiation 'fltk::VTKImageViewer<ImagePixelType>' being compiled
> 
> E:\P609\fltkVTKImageViewer.h(49) : error C2059: syntax error : '<'
> 
>         E:\P609\fltkVTKImageViewer.h(89) : see reference to class 
> template instantiation 'fltk::VTKImageViewer<ImagePixelType>' being compiled
> 
> E:\P609\fltkVTKImageViewer.h(49) : error C2238: unexpected token(s) 
> preceding ';'
> 
>         E:\P609\fltkVTKImageViewer.h(89) : see reference to class 
> template instantiation 'fltk::VTKImageViewer<ImagePixelType>' being compiled
> 
> E:\P609\fltkVTKImageViewer.h(50) : error C2059: syntax error : '<'
> 
>         E:\P609\fltkVTKImageViewer.h(89) : see reference to class 
> template instantiation 'fltk::VTKImageViewer<ImagePixelType>' being compiled
> 
> E:\P609\fltkVTKImageViewer.h(50) : error C2238: unexpected token(s) 
> preceding ';'
> 
>         E:\P609\fltkVTKImageViewer.h(89) : see reference to class 
> template instantiation 'fltk::VTKImageViewer<ImagePixelType>' being compiled
> 
> E:\P609\fltkVTKImageViewer.h(49) : error C2143: syntax error : missing 
> ';' before '<'
> 
>         E:\P609\main\main.cxx(45) : see reference to class template 
> instantiation 'fltk::VTKImageViewer<float>' being compiled
> 
> E:\P609\fltkVTKImageViewer.h(49) : error C2059: syntax error : '<'
> 
>         E:\P609\main\main.cxx(45) : see reference to class template 
> instantiation 'fltk::VTKImageViewer<float>' being compiled
> 
> E:\P609\fltkVTKImageViewer.h(49) : error C2238: unexpected token(s) 
> preceding ';'
> 
>         E:\P609\main\main.cxx(45) : see reference to class template 
> instantiation 'fltk::VTKImageViewer<float>' being compiled
> 
> E:\P609\fltkVTKImageViewer.h(50) : error C2059: syntax error : '<'
> 
>         E:\P609\main\main.cxx(45) : see reference to class template 
> instantiation 'fltk::VTKImageViewer<float>' being compiled
> 
> E:\P609\fltkVTKImageViewer.h(50) : error C2238: unexpected token(s) 
> preceding ';'
> 
>         E:\P609\main\main.cxx(45) : see reference to class template 
> instantiation 'fltk::VTKImageViewer<float>' being compiled
> 
> E:\P609\main\main.cxx(46) : error C2039: 'SetImage' : is not a member of 
> 'VTKImageViewerBase'
> 
>         E:\P609\fltkVTKImageViewerBase.h(26) : see declaration of 
> 'VTKImageViewerBase'
> 
> E:\P609\main\main.cxx(47) : error C2039: 'Show' : is not a member of 
> 'VTKImageViewerBase'
> 
>         E:\P609\fltkVTKImageViewerBase.h(26) : see declaration of 
> 'VTKImageViewerBase'
> 
> Error executing cl.exe.
> 
>  
> 
> It made me confused. In class fltkVTKImageViewer, it defines the member 
> of SetImage() and Show(). Why it found them in its parent class?
> 
> Thanks a lot !!
> 
> Sincerely,
>                           Zhao Yongqiang
>                           Dept. of Computer Science & Engineering
>                           Shanghai JiaoTong University
>                           Shanghai, China
>                           zhao-yq at cs . sjtu . edu . cn 
> <mailto:zhao-yq at cs . sjtu . edu . cn>
> 
>  
>