]> Creatis software - bbtk.git/blob - packages/vtk/src/bbvtkMIPCreator.cxx
be2a7d49c54f218c7a53f37d0ffd471c420e54c6
[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/04/18 12:59:52 $
7   Version:   $Revision: 1.2 $
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 //---------------------------------------------------------------------
78
79    void MIPCreator::Process()
80    {
81      mCast->SetInput( bbGetInputIn() );
82      mCast->SetScale( bbGetInputScale() / 100. );
83      mCast->SetShift( -bbGetInputShift() );
84
85      mMapper->Update();
86      
87      //     mVolume->GetProperty()->SetColor( bbGetInputColour()[0],  bbGetInputColour()[1], bbGetInputColour()[2] );
88      //     mVolume->GetProperty()->SetOpacity( bbGetInputOpacity() );
89      
90    }
91 }//namespace bbtk
92
93 #endif // _USE_VTK_
94