/*========================================================================= Program: bbtk Module: $RCSfile: bbvtkMIPCreator.cxx,v $ Language: C++ Date: $Date: 2008/05/09 10:39:47 $ Version: $Revision: 1.3 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ /** * \file * \brief */ #ifdef _USE_VTK_ #include "bbvtkMIPCreator.h" #include "bbvtkPackage.h" namespace bbvtk { BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,MIPCreator) BBTK_BLACK_BOX_IMPLEMENTATION(MIPCreator,bbtk::AtomicBlackBox); void MIPCreator::bbUserConstructor() { Init(); bbSetInputShift(0); bbSetInputScale(1.); } void MIPCreator::bbUserCopyConstructor() { Init(); } void MIPCreator::Init() { // Create the pipeline mCast = vtkImageShiftScale::New(); mCast->SetOutputScalarTypeToUnsignedChar(); mCast->ClampOverflowOn(); mMIP = vtkVolumeRayCastMIPFunction::New(); mMIP->SetMaximizeMethodToScalarValue(); mMapper = vtkVolumeRayCastMapper::New(); mMapper->SetVolumeRayCastFunction(mMIP); mMapper->SetInput(mCast->GetOutput()); // (smoother.GetOutput()) mVolume = vtkVolume::New(); mVolume->SetMapper(mMapper); // mMapper->ScalarVisibilityOff(); // mMapper->ImmediateModeRenderingOn(); bbSetOutputOut(mVolume); } void MIPCreator::bbUserDestructor() { mCast->Delete(); mMIP->Delete(); mMapper->Delete(); mVolume->Delete(); } //--------------------------------------------------------------------- void MIPCreator::Process() { mCast->SetInput( bbGetInputIn() ); mCast->SetScale( bbGetInputScale() / 100. ); mCast->SetShift( -bbGetInputShift() ); mMapper->Update(); // mVolume->GetProperty()->SetColor( bbGetInputColour()[0], bbGetInputColour()[1], bbGetInputColour()[2] ); // mVolume->GetProperty()->SetOpacity( bbGetInputOpacity() ); } }//namespace bbtk #endif // _USE_VTK_