]> Creatis software - creaMaracasVisu.git/blob - bbtk/src/bbmaracasvisuImageActor.cxx
no message
[creaMaracasVisu.git] / bbtk / src / bbmaracasvisuImageActor.cxx
1 #include "bbmaracasvisuImageActor.h"
2 #include "bbcreaMaracasVisuPackage.h"
3
4 #include "vtkImageShiftScale.h" 
5
6 namespace bbcreaMaracasVisu
7 {
8
9 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ImageActor)
10 BBTK_BLACK_BOX_IMPLEMENTATION(ImageActor,bbtk::AtomicBlackBox);
11 void ImageActor::Process()
12 {
13
14                 //JCP 04/04/09
15                 vtkRenderer *render                             = bbGetInputRenderer();
16                 vtkImageData *img                               = bbGetInputIn();
17                 vtkLinearTransform* transform   = bbGetInputTransform();
18
19                 if(img != NULL){
20                         
21                         imageshiftscale->SetInput( img );       
22                         imageshiftscale->SetOutputScalarTypeToUnsignedChar();   
23                         imageactor->SetInput( imageshiftscale->GetOutput() );   
24                         if (transform!=NULL){
25                           imageactor->SetUserTransform( transform );    
26                         } // transform
27                         if(render != NULL ){
28                                 render->AddActor( imageactor );
29                         } // render
30                         bbSetOutputOut(imageactor);
31                 } // img
32                         
33                         
34                 // Interface Update
35                 if ((firsttime==true) && (bbGetInputRenderer()!=NULL ))
36                 {
37                                 firsttime=false;
38                                 bbGetInputRenderer()->AddActor( imageactor );
39                 }
40                 
41                 bbSetOutputOut(imageactor);
42         
43 }
44 void ImageActor::bbUserSetDefaultValues()
45 {
46     firsttime = true;
47     imageactor = NULL;
48
49     bbSetInputIn(NULL);
50     bbSetInputTransform(NULL);
51     bbSetInputRenderer(NULL);
52   
53 }
54
55         
56         //-----------------------------------------------------------------     
57         void ImageActor::bbUserInitializeProcessing()
58         {
59                 imageactor = vtkImageActor::New();
60                 imageshiftscale = vtkImageShiftScale::New();
61         }
62         
63         //-----------------------------------------------------------------     
64         void ImageActor::bbUserFinalizeProcessing()
65         {
66         }
67         
68         //-----------------------------------------------------------------     
69 }
70 // EO namespace bbcreaMaracasVisu
71
72