]> Creatis software - bbtk.git/blob - packages/vtk/src/bbvtkMIPCreator.cxx
*** empty log message ***
[bbtk.git] / packages / vtk / src / bbvtkMIPCreator.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbvtkMIPCreator.cxx,v $
5   Language:  C++
6   Date:      $Date: 2008/05/09 10:39:47 $
7   Version:   $Revision: 1.3 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*/
18 /**
19  *  \file 
20  *  \brief 
21  */
22
23
24
25 #ifdef _USE_VTK_
26
27
28 #include "bbvtkMIPCreator.h"
29 #include "bbvtkPackage.h"
30
31 namespace bbvtk
32 {
33
34
35    BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,MIPCreator)
36    BBTK_BLACK_BOX_IMPLEMENTATION(MIPCreator,bbtk::AtomicBlackBox);
37
38
39
40
41
42    void MIPCreator::bbUserConstructor() 
43    { 
44      Init();
45      bbSetInputShift(0);
46      bbSetInputScale(1.);
47    }
48    void MIPCreator::bbUserCopyConstructor() 
49    { 
50      Init();
51    }
52
53    void MIPCreator::Init() 
54    { 
55
56     // Create the pipeline
57     mCast = vtkImageShiftScale::New();
58     mCast->SetOutputScalarTypeToUnsignedChar();
59     mCast->ClampOverflowOn();
60     
61     mMIP = vtkVolumeRayCastMIPFunction::New();
62     mMIP->SetMaximizeMethodToScalarValue();
63     
64     mMapper = vtkVolumeRayCastMapper::New();
65     mMapper->SetVolumeRayCastFunction(mMIP);
66     mMapper->SetInput(mCast->GetOutput()); // (smoother.GetOutput())
67     
68     mVolume = vtkVolume::New();
69     mVolume->SetMapper(mMapper);
70
71     //  mMapper->ScalarVisibilityOff();
72     //    mMapper->ImmediateModeRenderingOn();
73
74     bbSetOutputOut(mVolume);
75 }
76
77    void MIPCreator::bbUserDestructor() 
78    { 
79      mCast->Delete();
80      mMIP->Delete();
81      mMapper->Delete();
82      mVolume->Delete();
83
84    }
85 //---------------------------------------------------------------------
86
87    void MIPCreator::Process()
88    {
89      mCast->SetInput( bbGetInputIn() );
90      mCast->SetScale( bbGetInputScale() / 100. );
91      mCast->SetShift( -bbGetInputShift() );
92
93      mMapper->Update();
94      
95      //     mVolume->GetProperty()->SetColor( bbGetInputColour()[0],  bbGetInputColour()[1], bbGetInputColour()[2] );
96      //     mVolume->GetProperty()->SetOpacity( bbGetInputOpacity() );
97      
98    }
99 }//namespace bbtk
100
101 #endif // _USE_VTK_
102