00001 /*========================================================================= 00002 Program: bbtk 00003 Module: $RCSfile: bbvtkMIPCreator.cxx,v $ 00004 Language: C++ 00005 Date: $Date: 2008/10/17 08:18:30 $ 00006 Version: $Revision: 1.4 $ 00007 =========================================================================*/ 00008 00009 /* --------------------------------------------------------------------- 00010 00011 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) 00012 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux 00013 * 00014 * This software is governed by the CeCILL-B license under French law and 00015 * abiding by the rules of distribution of free software. You can use, 00016 * modify and/ or redistribute the software under the terms of the CeCILL-B 00017 * license as circulated by CEA, CNRS and INRIA at the following URL 00018 * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 00019 * or in the file LICENSE.txt. 00020 * 00021 * As a counterpart to the access to the source code and rights to copy, 00022 * modify and redistribute granted by the license, users are provided only 00023 * with a limited warranty and the software's author, the holder of the 00024 * economic rights, and the successive licensors have only limited 00025 * liability. 00026 * 00027 * The fact that you are presently reading this means that you have had 00028 * knowledge of the CeCILL-B license and that you accept its terms. 00029 * ------------------------------------------------------------------------ */ 00030 00038 #ifdef _USE_VTK_ 00039 00040 00041 #include "bbvtkMIPCreator.h" 00042 #include "bbvtkPackage.h" 00043 00044 namespace bbvtk 00045 { 00046 00047 00048 BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,MIPCreator) 00049 BBTK_BLACK_BOX_IMPLEMENTATION(MIPCreator,bbtk::AtomicBlackBox); 00050 00051 00052 00053 00054 00055 void MIPCreator::bbUserConstructor() 00056 { 00057 Init(); 00058 bbSetInputShift(0); 00059 bbSetInputScale(1.); 00060 } 00061 void MIPCreator::bbUserCopyConstructor() 00062 { 00063 Init(); 00064 } 00065 00066 void MIPCreator::Init() 00067 { 00068 00069 // Create the pipeline 00070 mCast = vtkImageShiftScale::New(); 00071 mCast->SetOutputScalarTypeToUnsignedChar(); 00072 mCast->ClampOverflowOn(); 00073 00074 mMIP = vtkVolumeRayCastMIPFunction::New(); 00075 mMIP->SetMaximizeMethodToScalarValue(); 00076 00077 mMapper = vtkVolumeRayCastMapper::New(); 00078 mMapper->SetVolumeRayCastFunction(mMIP); 00079 mMapper->SetInput(mCast->GetOutput()); // (smoother.GetOutput()) 00080 00081 mVolume = vtkVolume::New(); 00082 mVolume->SetMapper(mMapper); 00083 00084 // mMapper->ScalarVisibilityOff(); 00085 // mMapper->ImmediateModeRenderingOn(); 00086 00087 bbSetOutputOut(mVolume); 00088 } 00089 00090 void MIPCreator::bbUserDestructor() 00091 { 00092 mCast->Delete(); 00093 mMIP->Delete(); 00094 mMapper->Delete(); 00095 mVolume->Delete(); 00096 00097 } 00098 //--------------------------------------------------------------------- 00099 00100 void MIPCreator::Process() 00101 { 00102 mCast->SetInput( bbGetInputIn() ); 00103 mCast->SetScale( bbGetInputScale() / 100. ); 00104 mCast->SetShift( -bbGetInputShift() ); 00105 00106 mMapper->Update(); 00107 00108 // mVolume->GetProperty()->SetColor( bbGetInputColour()[0], bbGetInputColour()[1], bbGetInputColour()[2] ); 00109 // mVolume->GetProperty()->SetOpacity( bbGetInputOpacity() ); 00110 00111 } 00112 }//namespace bbtk 00113 00114 #endif // _USE_VTK_ 00115
1.5.6