]> Creatis software - bbtk.git/blobdiff - packages/vtk/src/bbvtkMIPCreator.cxx
*** empty log message ***
[bbtk.git] / packages / vtk / src / bbvtkMIPCreator.cxx
diff --git a/packages/vtk/src/bbvtkMIPCreator.cxx b/packages/vtk/src/bbvtkMIPCreator.cxx
new file mode 100644 (file)
index 0000000..708d194
--- /dev/null
@@ -0,0 +1,94 @@
+/*=========================================================================
+                                                                                
+  Program:   bbtk
+  Module:    $RCSfile: bbvtkMIPCreator.cxx,v $
+  Language:  C++
+  Date:      $Date: 2008/03/19 13:30:18 $
+  Version:   $Revision: 1.1 $
+                                                                                
+  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_USER_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::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_
+