[vtkusers] ITK beginer

Anka Kochanowska pluszcz at gmail.com
Thu Mar 1 12:11:43 EST 2012


Hi!
This example runs perfectly.

Here is my CMakeLists.txt:
_
cmake_minimum_required(VERSION 2.6)

PROJECT(JPGread)

FIND_PACKAGE(VTK REQUIRED)
INCLUDE(${VTK_USE_FILE})

ADD_EXECUTABLE(JPGread jpgread.cxx)
TARGET_LINK_LIBRARIES(JPGread vtkHybrid vtkWidgets)
_

ITK is not needed.

Anka

On Thu, Mar 1, 2012 at 11:57 AM, Massi <Massinissa.Bandou at usherbrooke.ca>wrote:

> Hi
>
> I started learning ITK-VTK according this web site: (really good for a
> beginner)
> http://www.vtk.org/Wiki/VTK/Examples/Cxx
>
> There is an example of reading an JPEG image (your image should be in the
> same directory as you executable)
>
> #include "itkImageFileReader.h"
> #include "itkImage.h"
> #include "vtkJPEGReader.h"
> #include "vtkImageViewer2.h"
> #include "vtkRenderer.h"
> #include "vtkSmartPointer.h"
> #include "vtkRenderWindowInteractor.h"
>
> int main(int arg, char ** argv)
>  {
>         vtkSmartPointer<vtkJPEGReader> jpegReader =
> vtkSmartPointer<vtkJPEGReader>::New();
>         jpegReader->SetFileName("your image.jpg");
>
>  //Vizualisation
>         vtkSmartPointer<vtkImageViewer2> imageViewer =
> vtkSmartPointer<vtkImageViewer2>::New();
>         imageViewer->SetInputConnection(jpegReader->GetOutputPort());
>
>         vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
>         vtkSmartPointer<vtkRenderWindowInteractor>::New();
>         imageViewer->SetupInteractor(renderWindowInteractor);
>
>         imageViewer->Render();
>         imageViewer->GetRenderer()->ResetCamera();
>         imageViewer->Render();
>
>         renderWindowInteractor->Start();
>
>  return 0;
>  }
>
> make sure you have all the headers!!
>
> Massi
>
>
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/ITK-beginer-tp5528382p5528483.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120301/bebd6767/attachment.htm>


More information about the vtkusers mailing list