1 // $Header: /cvs/public/gdcm/vtk/Attic/testvtkGdcmReader.cxx,v 1.1 2003/05/05 14:13:59 frog Exp $
3 #include "vtkRenderer.h"
4 #include "vtkRenderWindow.h"
5 #include "vtkRenderWindowInteractor.h"
6 #include "vtkPolyDataMapper.h"
8 #include "vtkImageMapper.h"
9 #include "vtkImageViewer.h"
10 #include "vtkMatrix4x4.h"
11 #include "vtkLookupTable.h"
12 #include "vtkMatrixToLinearTransform.h"
13 #include "vtkTexture.h"
14 #include "vtkPlaneSource.h"
15 #include "vtkTextureMapToPlane.h"
16 #include "vtkDataSetMapper.h"
18 #include "vtkImageCast.h"
19 #include "vtkPNGWriter.h"
20 #include "vtkTexture.h"
22 #include "vtkGdcmReader.h"
25 int main( int argc, char *argv[] )
32 vtkGdcmReader *reader = vtkGdcmReader::New();
36 // reader->SetFileName("../Data/CT-MONO2-8-abdo.dcm");
37 // 16 12 11 U : OK but saturated
38 // reader->SetFileName("../Data/CT-MONO2-12-lomb-an2.acr2");
40 //OKreader->SetFileName("../Data/MR-MONO2-12-an2.acr2");
42 //reader->SetFileName("../Data/CR-MONO1-10-chest.dcm");
44 // 16 16 15 S: OK saturation ?
45 // reader->SetFileName("../Data/CT-MONO2-16-ort.dcm");
47 reader->SetFileName("../Data/CT-MONO2-16-ankle.dcm");
48 reader->UpdateWholeExtent();
49 vtkImageData *ima = reader->GetOutput();
50 taille=ima->GetDimensions();
51 x = taille[0]; y = taille[1];
52 cout << "Taille de l'image en X=" << x << " et en Y=" << y << endl;
54 vtkLookupTable *VTKtable = vtkLookupTable::New();
55 VTKtable->SetNumberOfColors(1000);
56 VTKtable->SetTableRange(0,1000);
57 VTKtable->SetSaturationRange(0,0);
58 VTKtable->SetHueRange(0,1);
59 VTKtable->SetValueRange(0,1);
60 VTKtable->SetAlphaRange(1,1);
63 vtkTexture * VTKtexture = vtkTexture::New();
64 VTKtexture->SetInput(ima);
65 VTKtexture->InterpolateOn();
66 VTKtexture->SetLookupTable(VTKtable);
68 vtkPlaneSource *VTKplane = vtkPlaneSource::New();
69 VTKplane->SetOrigin( -0.5, -0.5, 0.0);
70 VTKplane->SetPoint1( 0.5, -0.5, 0.0);
71 VTKplane->SetPoint2( -0.5, 0.5, 0.0);
73 vtkPolyDataMapper *VTKplaneMapper = vtkPolyDataMapper::New();
74 VTKplaneMapper->SetInput(VTKplane->GetOutput());
76 vtkActor* VTKplaneActor = vtkActor::New();
77 VTKplaneActor->SetTexture(VTKtexture);
78 VTKplaneActor->SetMapper(VTKplaneMapper);
79 VTKplaneActor->PickableOn();
81 vtkRenderer *ren = vtkRenderer::New();
82 vtkRenderWindow *renwin = vtkRenderWindow::New();
83 renwin->AddRenderer(ren);
84 vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
85 iren->SetRenderWindow(renwin);
86 ren->AddActor(VTKplaneActor);
87 ren->SetBackground(0,0,0.5);