/*=========================================================================
Program: Visualization Toolkit Module: $RCSfile: GPURenderDemo.cxx,v $ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm 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 notice for more information. =========================================================================*/ // VTK includes #include "vtkBoxWidget.h" #include "vtkCamera.h" #include "vtkCommand.h" #include "vtkColorTransferFunction.h" #include "vtkDICOMImageReader.h" #include "vtkImageData.h" #include "vtkImageResample.h" #include "vtkMetaImageReader.h" #include "vtkPiecewiseFunction.h" #include "vtkPlanes.h" #include "vtkProperty.h" #include "vtkRenderer.h" #include "vtkRenderWindow.h" #include "vtkRenderWindowInteractor.h" #include "vtkVolume.h" #include "vtkVolumeProperty.h" #include "vtkXMLImageDataReader.h" #include "vtkGPUVolumeRayCastMapper.h" #define VTI_FILETYPE 1 #define MHA_FILETYPE 2 // FB: comment for testing svn // Callback for moving the planes from the box widget to the mapper class vtkBoxWidgetCallback : public vtkCommand { public: static vtkBoxWidgetCallback *New() { return new vtkBoxWidgetCallback; } virtual void Execute(vtkObject *caller, unsigned long, void*) { vtkBoxWidget *widget = reinterpret_cast<vtkBoxWidget*>(caller); if (this->Mapper) { vtkPlanes *planes = vtkPlanes::New(); widget->GetPlanes(planes); this->Mapper->SetClippingPlanes(planes); planes->Delete(); } } void SetMapper(vtkGPUVolumeRayCastMapper* m) { this->Mapper = m; } protected: vtkBoxWidgetCallback() { this->Mapper = 0; } vtkGPUVolumeRayCastMapper *Mapper; }; void PrintUsage() { cout << "Usage: " << endl; cout << endl; cout << " GPURenderDemo <options>" << endl; cout << endl; cout << "where options may include: " << endl; cout << endl; cout << " -DICOM <directory>" << endl; cout << " -VTI <filename>" << endl; cout << " -MHA <filename>" << endl; cout << " -DependentComponents" << endl; cout << " -Clip" << endl; cout << " -MIP <window> <level>" << endl; cout << " -CompositeRamp <window> <level>" << endl; cout << " -CompositeShadeRamp <window> <level>" << endl; cout << " -CT_Skin" << endl; cout << " -CT_Bone" << endl; cout << " -CT_Muscle" << endl; cout << " -FrameRate <rate>" << endl; cout << " -DataReduction <factor>" << endl; cout << endl; cout << "You must use either the -DICOM option to specify the directory where" <<