diff --git a/CMakeExternals/MITKData.cmake b/CMakeExternals/MITKData.cmake index 6f2c3f96d8..2e1bb18f79 100644 --- a/CMakeExternals/MITKData.cmake +++ b/CMakeExternals/MITKData.cmake @@ -1,37 +1,37 @@ #----------------------------------------------------------------------------- # MITK Data #----------------------------------------------------------------------------- # Sanity checks if(DEFINED MITK_DATA_DIR AND NOT EXISTS ${MITK_DATA_DIR}) message(FATAL_ERROR "MITK_DATA_DIR variable is defined but corresponds to non-existing directory") endif() set(proj MITK-Data) set(proj_DEPENDENCIES) set(MITK-Data_DEPENDS ${proj}) if(BUILD_TESTING) - set(revision_tag 569c8296) # first 8 characters of hash-tag + set(revision_tag 17e09087) # first 8 characters of hash-tag # ^^^^^^^^ these are just to check correct length of hash part ExternalProject_Add(${proj} SOURCE_DIR ${proj} URL ${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/MITK-Data_${revision_tag}.tar.gz UPDATE_COMMAND "" CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" DEPENDS ${proj_DEPENDENCIES} ) set(MITK_DATA_DIR ${CMAKE_CURRENT_BINARY_DIR}/${proj}) else() mitkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}") endif(BUILD_TESTING) diff --git a/CMakeExternals/VTK-6.1.0+74f4888.patch b/CMakeExternals/VTK-6.2.0.patch similarity index 60% rename from CMakeExternals/VTK-6.1.0+74f4888.patch rename to CMakeExternals/VTK-6.2.0.patch index bb1b916d7d..9df7cdf2c4 100644 --- a/CMakeExternals/VTK-6.1.0+74f4888.patch +++ b/CMakeExternals/VTK-6.2.0.patch @@ -1,34 +1,21 @@ diff -urNb VTK-6.1.0+74f4888/GUISupport/Qt/CMakeLists.txt VTK/GUISupport/Qt/CMakeLists.txt --- VTK-6.1.0+74f4888/GUISupport/Qt/CMakeLists.txt 2014-09-24 14:50:44.000000000 +0200 +++ VTK/GUISupport/Qt/CMakeLists.txt 2015-01-23 01:59:32.308391229 +0100 -@@ -150,6 +150,7 @@ +@@ -153,6 +153,7 @@ if(BUILD_SHARED_LIBS) endif() - + if(NOT VTK_INSTALL_NO_QT_PLUGIN) + install(TARGETS QVTKWidgetPlugin DESTINATION ${VTK_INSTALL_QT_DIR}) # Set default plugin install directory. set(DOLLAR "$") if(DEFINED VTK_INSTALL_QT_PLUGIN_DIR) -@@ -166,8 +167,8 @@ +@@ -169,8 +170,8 @@ if(BUILD_SHARED_LIBS) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/PluginInstall.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/PluginInstall.cmake @ONLY) - set_target_properties(${vtk-module} PROPERTIES POST_INSTALL_SCRIPT - ${CMAKE_CURRENT_BINARY_DIR}/PluginInstall.cmake) + #set_target_properties(${vtk-module} PROPERTIES POST_INSTALL_SCRIPT + # ${CMAKE_CURRENT_BINARY_DIR}/PluginInstall.cmake) endif() endif() - -diff -urNb VTK-6.1.0+74f4888/Rendering/OpenGL/vtkOpenGL.h VTK/Rendering/OpenGL/vtkOpenGL.h ---- VTK-6.1.0+74f4888/Rendering/OpenGL/vtkOpenGL.h 2014-09-24 14:50:44.000000000 +0200 -+++ VTK/Rendering/OpenGL/vtkOpenGL.h 2015-01-23 01:13:23.568339250 +0100 -@@ -19,7 +19,7 @@ - #include "vtkConfigure.h" - - // To prevent gl.h to include glext.h provided by the system --#define GL_GLEXT_LEGACY -+//#define GL_GLEXT_LEGACY - #if defined(__APPLE__) && (defined(VTK_USE_CARBON) || defined(VTK_USE_COCOA)) - # include // Include OpenGL API. - #else diff --git a/CMakeExternals/VTK.cmake b/CMakeExternals/VTK.cmake index 12a6143d51..81b107f692 100644 --- a/CMakeExternals/VTK.cmake +++ b/CMakeExternals/VTK.cmake @@ -1,118 +1,118 @@ #----------------------------------------------------------------------------- # VTK #----------------------------------------------------------------------------- if(WIN32) option(VTK_USE_SYSTEM_FREETYPE OFF) else(WIN32) option(VTK_USE_SYSTEM_FREETYPE ON) endif(WIN32) # Sanity checks if(DEFINED VTK_DIR AND NOT EXISTS ${VTK_DIR}) message(FATAL_ERROR "VTK_DIR variable is defined but corresponds to non-existing directory") endif() set(proj VTK) set(proj_DEPENDENCIES ) set(VTK_DEPENDS ${proj}) if(MITK_USE_HDF5) list(APPEND proj_DEPENDENCIES HDF5) endif() if(NOT DEFINED VTK_DIR) set(additional_cmake_args ) if(MINGW) set(additional_cmake_args -DCMAKE_USE_WIN32_THREADS:BOOL=ON -DCMAKE_USE_PTHREADS:BOOL=OFF -DVTK_USE_VIDEO4WINDOWS:BOOL=OFF # no header files provided by MinGW ) endif() if(WIN32) # see http://bugs.mitk.org/show_bug.cgi?id=17858 list(APPEND additional_cmake_args -DVTK_DO_NOT_DEFINE_OSTREAM_SLL:BOOL=ON -DVTK_DO_NOT_DEFINE_OSTREAM_ULL:BOOL=ON ) endif() # Optionally enable memory leak checks for any objects derived from vtkObject. This # will force unit tests to fail if they have any of these memory leaks. option(MITK_VTK_DEBUG_LEAKS OFF) mark_as_advanced(MITK_VTK_DEBUG_LEAKS) list(APPEND additional_cmake_args -DVTK_DEBUG_LEAKS:BOOL=${MITK_VTK_DEBUG_LEAKS} ) if(MITK_USE_Python) if(NOT MITK_USE_SYSTEM_PYTHON) list(APPEND proj_DEPENDENCIES Python) endif() list(APPEND additional_cmake_args -DVTK_WRAP_PYTHON:BOOL=ON -DVTK_USE_TK:BOOL=OFF -DVTK_WINDOWS_PYTHON_DEBUGGABLE:BOOL=OFF -DPYTHON_EXECUTABLE:FILEPATH=${PYTHON_EXECUTABLE} -DPYTHON_INCLUDE_DIR:PATH=${PYTHON_INCLUDE_DIR} -DPYTHON_INCLUDE_DIR2:PATH=${PYTHON_INCLUDE_DIR2} -DPYTHON_LIBRARY:FILEPATH=${PYTHON_LIBRARY} ) else() list(APPEND additional_cmake_args -DVTK_WRAP_PYTHON:BOOL=OFF -DVTK_WINDOWS_PYTHON_DEBUGGABLE:BOOL=OFF ) endif() if(MITK_USE_QT) list(APPEND additional_cmake_args -DVTK_QT_VERSION:STRING=${DESIRED_QT_VERSION} -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DModule_vtkGUISupportQt:BOOL=ON -DModule_vtkGUISupportQtWebkit:BOOL=ON -DModule_vtkGUISupportQtSQL:BOOL=ON -DModule_vtkRenderingQt:BOOL=ON -DVTK_Group_Qt:BOOL=ON ) endif() if(CTEST_USE_LAUNCHERS) list(APPEND additional_cmake_args "-DCMAKE_PROJECT_${proj}_INCLUDE:FILEPATH=${CMAKE_ROOT}/Modules/CTestUseLaunchers.cmake" ) endif() - set(VTK_URL ${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/VTK-6.1.0+74f4888.tar.gz) - set(VTK_URL_MD5 1f19dae22c42c032109bd3cf91c4e8c9) + set(VTK_URL ${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/VTK-6.2.0.tar.gz) + set(VTK_URL_MD5 4790f8b3acdbc376997fbdc9d203f0b7) ExternalProject_Add(${proj} LIST_SEPARATOR ${sep} URL ${VTK_URL} URL_MD5 ${VTK_URL_MD5} - PATCH_COMMAND ${PATCH_COMMAND} -N -p1 -i ${CMAKE_CURRENT_LIST_DIR}/VTK-6.1.0+74f4888.patch + PATCH_COMMAND ${PATCH_COMMAND} -N -p1 -i ${CMAKE_CURRENT_LIST_DIR}/VTK-6.2.0.patch CMAKE_GENERATOR ${gen} CMAKE_ARGS ${ep_common_args} -DVTK_WRAP_TCL:BOOL=OFF -DVTK_WRAP_PYTHON:BOOL=OFF -DVTK_WRAP_JAVA:BOOL=OFF -DVTK_USE_SYSTEM_FREETYPE:BOOL=${VTK_USE_SYSTEM_FREETYPE} -DVTK_LEGACY_REMOVE:BOOL=ON -DModule_vtkTestingRendering:BOOL=ON -DVTK_MAKE_INSTANTIATORS:BOOL=ON ${additional_cmake_args} DEPENDS ${proj_DEPENDENCIES} ) set(VTK_DIR ${ep_prefix}) mitkFunctionInstallExternalCMakeProject(${proj}) else() mitkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}") endif() diff --git a/Modules/Core/include/mitkSurfaceVtkMapper3D.h b/Modules/Core/include/mitkSurfaceVtkMapper3D.h index 2ba365655f..6bf165667c 100644 --- a/Modules/Core/include/mitkSurfaceVtkMapper3D.h +++ b/Modules/Core/include/mitkSurfaceVtkMapper3D.h @@ -1,149 +1,148 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef mitkSurfaceVtkMapper3D_h #define mitkSurfaceVtkMapper3D_h #include #include #include "mitkVtkMapper.h" #include "mitkBaseRenderer.h" #include "mitkLocalStorageHandler.h" #include -#include #include #include #include #include #include #include namespace mitk { /** * @brief Vtk-based mapper for Surfaces. * * The mapper renders a surface in 3D. The actor is adapted according to the geometry in * the base class in mitk::VtkMapper::UpdateVtkTransform(). * * Properties that can be set for surfaces and influence the surfaceVTKMapper3D are: * * - \b "Backface Culling": True enables backface culling, which means only front-facing polygons will be visualized. False/disabled by default. * - \b "color": (ColorProperty) Diffuse color of the surface object (this property will be read when material.diffuseColor is not defined) * - \b "Opacity": (FloatProperty) Opacity of the surface object * - \b "material.ambientColor": (ColorProperty) Ambient color of the surface object * - \b "material.ambientCoefficient": ( FloatProperty) Ambient coefficient of the surface object * - \b "material.diffuseColor": ( ColorProperty) Diffuse color of the surface object * - \b "material.diffuseCoefficient": (FloatProperty) Diffuse coefficient of the surface object * - \b "material.specularColor": (ColorProperty) Specular Color of the surface object * - \b "material.specularCoefficient": (FloatProperty) Specular coefficient of the surface object * - \b "material.specularPower": (FloatProperty) Specular power of the surface object * - \b "material.interpolation": (VtkInterpolationProperty) Interpolation * - \b "material.representation": (VtkRepresentationProperty*) Representation * - \b "material.wireframeLineWidth": (FloatProperty) Width in pixels of the lines drawn. * - \b "scalar visibility": (BoolProperty) If the scarlars of the surface are visible * - \b "Surface.TransferFunction (TransferFunctionProperty) Set a transferfunction for coloring the surface * - \b "LookupTable (LookupTableProperty) LookupTable * Properties to look for are: * * - \b "scalar visibility": if set to on, scalars assigned to the data are shown * Turn this on if using a lookup table. * - \b "ScalarsRangeMinimum": Optional. Can be used to store the scalar min, e.g. * for the level window settings. * - \b "ScalarsRangeMaximum": Optional. See above. * * There might be still some other, deprecated properties. These will not be documented anymore. * Please check the source if you really need them. * * @ingroup Mapper */ class MITKCORE_EXPORT SurfaceVtkMapper3D : public VtkMapper { public: mitkClassMacro(SurfaceVtkMapper3D, VtkMapper); itkFactorylessNewMacro(Self) itkCloneMacro(Self) itkSetMacro(GenerateNormals, bool); itkGetMacro(GenerateNormals, bool); virtual const mitk::Surface* GetInput(); virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer); virtual void ApplyAllProperties(mitk::BaseRenderer* renderer, vtkActor* actor); static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false); protected: SurfaceVtkMapper3D(); virtual ~SurfaceVtkMapper3D(); virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer); virtual void ResetMapper( mitk::BaseRenderer* renderer ); /** Checks whether the specified property is a ClippingProperty and if yes, * adds it to m_ClippingPlaneCollection (internal method). */ virtual void CheckForClippingProperty( mitk::BaseRenderer* renderer, mitk::BaseProperty *property ); bool m_GenerateNormals; public: class LocalStorage : public mitk::Mapper::BaseLocalStorage { public: vtkSmartPointer m_Actor; - vtkSmartPointer m_VtkPolyDataMapper; + vtkSmartPointer m_VtkPolyDataMapper; vtkSmartPointer m_VtkPolyDataNormals; vtkSmartPointer m_ClippingPlaneCollection; vtkSmartPointer m_DepthSort; itk::TimeStamp m_ShaderTimestampUpdate; LocalStorage() { - m_VtkPolyDataMapper = vtkSmartPointer::New(); + m_VtkPolyDataMapper = vtkSmartPointer::New(); m_VtkPolyDataNormals = vtkSmartPointer::New(); m_Actor = vtkSmartPointer::New(); m_ClippingPlaneCollection = vtkSmartPointer::New(); m_Actor->SetMapper(m_VtkPolyDataMapper); m_DepthSort = vtkSmartPointer::New(); } ~LocalStorage() { } }; mitk::LocalStorageHandler m_LSH; static void ApplyMitkPropertiesToVtkProperty(mitk::DataNode *node, vtkProperty* property, mitk::BaseRenderer* renderer); static void SetDefaultPropertiesForVtkProperty(mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite); }; } // namespace mitk #endif /* mitkSurfaceVtkMapper3D_h */ diff --git a/Modules/DiffusionImaging/DiffusionCore/Rendering/vtkOdfSource.cxx b/Modules/DiffusionImaging/DiffusionCore/Rendering/vtkOdfSource.cxx index 76f372b923..94911be160 100644 --- a/Modules/DiffusionImaging/DiffusionCore/Rendering/vtkOdfSource.cxx +++ b/Modules/DiffusionImaging/DiffusionCore/Rendering/vtkOdfSource.cxx @@ -1,118 +1,115 @@ #include "vtkOdfSource.h" #include "vtkCellArray.h" #include "vtkInformation.h" #include "vtkInformationVector.h" #include "vtkPoints.h" #include "vtkStreamingDemandDrivenPipeline.h" #include "vtkObjectFactory.h" #include "vtkDoubleArray.h" #include "vtkCellData.h" #include vtkStandardNewMacro(vtkOdfSource); vtkOdfSource::vtkOdfSource() { Scale = 1; this->SetNumberOfInputPorts(0); } //---------------------------------------------------------------------------- int vtkOdfSource::RequestData( vtkInformation *vtkNotUsed(request), vtkInformationVector **vtkNotUsed(inputVector), vtkInformationVector *outputVector) { vtkPolyData* TemplateOdf = OdfType::GetBaseMesh(); // get the info object vtkInformation *outInfo = outputVector->GetInformationObject(0); // get the ouptut vtkPolyData *output = vtkPolyData::SafeDownCast( outInfo->Get(vtkDataObject::DATA_OBJECT())); OdfType colorOdf; switch(Normalization) { case mitk::ODFN_MINMAX: Odf = Odf.MinMaxNormalize(); colorOdf = Odf; break; case mitk::ODFN_MAX: Odf = Odf.MaxNormalize(); colorOdf = Odf; break; case mitk::ODFN_NONE: colorOdf = Odf.MaxNormalize(); break; default: Odf = Odf.MinMaxNormalize(); colorOdf = Odf; } vtkIdType cellId = 0; vtkIdType npts; vtkIdType *pts; vtkPoints *newPoints; vtkCellArray* polys = TemplateOdf->GetPolys(); output->SetPolys(polys); vtkDoubleArray* colors = vtkDoubleArray::New(); int numCells = polys->GetNumberOfCells(); colors->Allocate(numCells); polys->InitTraversal(); newPoints = vtkPoints::New(); int numPoints = TemplateOdf->GetPoints()->GetNumberOfPoints(); newPoints->Allocate(numPoints); while(polys->GetNextCell(npts,pts)) { double val = 0; for(int i=0; iSetComponent(0,cellId++, 1-val); } for(int j=0; jGetPoints()->GetPoint(j,p); double val = Odf.GetElement(j); p[0] *= val*Scale*AdditionalScale*0.5; p[1] *= val*Scale*AdditionalScale*0.5; p[2] *= val*Scale*AdditionalScale*0.5; newPoints->InsertNextPoint(p); } output->SetPoints(newPoints); output->GetCellData()->SetScalars(colors); colors->Delete(); newPoints->Delete(); return 1; } //---------------------------------------------------------------------------- void vtkOdfSource::PrintSelf(ostream& os, vtkIndent indent) { this->Superclass::PrintSelf(os,indent); } //---------------------------------------------------------------------------- int vtkOdfSource::RequestInformation( vtkInformation *vtkNotUsed(request), vtkInformationVector **vtkNotUsed(inputVector), vtkInformationVector *outputVector) { // get the info object vtkInformation *outInfo = outputVector->GetInformationObject(0); - outInfo->Set(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(), - -1); - - outInfo->Set(vtkStreamingDemandDrivenPipeline::WHOLE_BOUNDING_BOX(),1,1,1,1,1,1); + outInfo->Set(vtkAlgorithm::CAN_HANDLE_PIECE_REQUEST(),0); return 1; } diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleMapper3D.cpp b/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleMapper3D.cpp index 0262c5cdbd..42539cf4a5 100644 --- a/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleMapper3D.cpp +++ b/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleMapper3D.cpp @@ -1,250 +1,251 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkFiberBundleMapper3D.h" #include #include #include #include #include #include #include #include #include +#include mitk::FiberBundleMapper3D::FiberBundleMapper3D() : m_TubeRadius(0.0) , m_TubeSides(15) , m_LineWidth(1) { m_lut = vtkLookupTable::New(); m_lut->Build(); } mitk::FiberBundleMapper3D::~FiberBundleMapper3D() { } const mitk::FiberBundle* mitk::FiberBundleMapper3D::GetInput() { return static_cast ( GetDataNode()->GetData() ); } /* This method is called once the mapper gets new input, for UI rotation or changes in colorcoding this method is NOT called */ void mitk::FiberBundleMapper3D::InternalGenerateData(mitk::BaseRenderer *renderer) { mitk::FiberBundle* fiberBundle = dynamic_cast (GetDataNode()->GetData()); if (fiberBundle == NULL) return; vtkSmartPointer fiberPolyData = fiberBundle->GetFiberPolyData(); if (fiberPolyData == NULL) return; fiberPolyData->GetPointData()->AddArray(fiberBundle->GetFiberColors()); float tmpopa; this->GetDataNode()->GetOpacity(tmpopa, NULL); FBXLocalStorage3D *localStorage = m_LocalStorageHandler.GetLocalStorage(renderer); if (m_TubeRadius>0.0) { vtkSmartPointer tubeFilter = vtkSmartPointer::New(); tubeFilter->SetInputData(fiberPolyData); tubeFilter->SetNumberOfSides(m_TubeSides); tubeFilter->SetRadius(m_TubeRadius); tubeFilter->Update(); fiberPolyData = tubeFilter->GetOutput(); } else if (m_RibbonWidth>0.0) { vtkSmartPointer tubeFilter = vtkSmartPointer::New(); tubeFilter->SetInputData(fiberPolyData); tubeFilter->SetWidth(m_RibbonWidth); tubeFilter->Update(); fiberPolyData = tubeFilter->GetOutput(); } if (tmpopa<1) { vtkSmartPointer depthSort = vtkSmartPointer::New(); depthSort->SetInputData( fiberPolyData ); depthSort->SetCamera( renderer->GetVtkRenderer()->GetActiveCamera() ); depthSort->SetDirectionToFrontToBack(); depthSort->Update(); localStorage->m_FiberMapper->SetInputConnection(depthSort->GetOutputPort()); } else { localStorage->m_FiberMapper->SetInputData(fiberPolyData); } if (m_Lighting) { float floatProp = 1.0; GetDataNode()->GetFloatProperty("light.ambient", floatProp); localStorage->m_FiberActor->GetProperty()->SetAmbient(floatProp); GetDataNode()->GetFloatProperty("light.diffuse", floatProp); localStorage->m_FiberActor->GetProperty()->SetDiffuse(floatProp); GetDataNode()->GetFloatProperty("light.specular", floatProp); localStorage->m_FiberActor->GetProperty()->SetSpecular(floatProp); GetDataNode()->GetFloatProperty("light.specularpower", floatProp); localStorage->m_FiberActor->GetProperty()->SetSpecularPower( floatProp ); mitk::ColorProperty* ambientC = dynamic_cast(GetDataNode()->GetProperty("light.ambientcolor")); mitk::ColorProperty* diffuseC = dynamic_cast(GetDataNode()->GetProperty("light.diffusecolor")); mitk::ColorProperty* specularC = dynamic_cast(GetDataNode()->GetProperty("light.specularcolor")); localStorage->m_FiberActor->GetProperty()->SetAmbientColor( ambientC->GetColor()[0], ambientC->GetColor()[1], ambientC->GetColor()[2] ); localStorage->m_FiberActor->GetProperty()->SetDiffuseColor( diffuseC->GetColor()[0], diffuseC->GetColor()[1], diffuseC->GetColor()[2] ); localStorage->m_FiberActor->GetProperty()->SetSpecularColor( specularC->GetColor()[0], specularC->GetColor()[1], specularC->GetColor()[2] ); localStorage->m_FiberActor->GetProperty()->SetLighting(true); } else { localStorage->m_FiberActor->GetProperty()->SetLighting(false); } localStorage->m_FiberMapper->SelectColorArray("FIBER_COLORS"); localStorage->m_FiberMapper->ScalarVisibilityOn(); localStorage->m_FiberMapper->SetScalarModeToUsePointFieldData(); localStorage->m_FiberActor->SetMapper(localStorage->m_FiberMapper); localStorage->m_FiberMapper->SetLookupTable(m_lut); // set Opacity localStorage->m_FiberActor->GetProperty()->SetOpacity((double) tmpopa); localStorage->m_FiberActor->GetProperty()->SetLineWidth(m_LineWidth); localStorage->m_FiberAssembly->AddPart(localStorage->m_FiberActor); localStorage->m_LastUpdateTime.Modified(); } void mitk::FiberBundleMapper3D::GenerateDataForRenderer( mitk::BaseRenderer *renderer ) { bool visible = true; GetDataNode()->GetVisibility(visible, renderer, "visible"); if ( !visible ) return; const DataNode* node = this->GetDataNode(); FBXLocalStorage3D* localStorage = m_LocalStorageHandler.GetLocalStorage(renderer); mitk::FiberBundle* fiberBundle = dynamic_cast(node->GetData()); // did any rendering properties change? float tubeRadius = 0; node->GetFloatProperty("shape.tuberadius", tubeRadius); if (m_TubeRadius!=tubeRadius) { m_TubeRadius = tubeRadius; fiberBundle->RequestUpdate3D(); } int tubeSides = 0; node->GetIntProperty("shape.tubesides", tubeSides); if (m_TubeSides!=tubeSides) { m_TubeSides = tubeSides; fiberBundle->RequestUpdate3D(); } int lineWidth = 0; node->GetIntProperty("shape.linewidth", lineWidth); if (m_LineWidth!=lineWidth) { m_LineWidth = lineWidth; fiberBundle->RequestUpdate3D(); } float ribbonWidth = 0; node->GetFloatProperty("shape.ribbonwidth", ribbonWidth); if (m_RibbonWidth!=ribbonWidth) { m_RibbonWidth = ribbonWidth; fiberBundle->RequestUpdate3D(); } bool lighting = false; node->GetBoolProperty("light.enable", lighting); if (m_Lighting!=lighting) { m_Lighting = lighting; fiberBundle->RequestUpdate3D(); } if (localStorage->m_LastUpdateTime>=fiberBundle->GetUpdateTime3D()) return; // Calculate time step of the input data for the specified renderer (integer value) // this method is implemented in mitkMapper this->CalculateTimeStep( renderer ); this->InternalGenerateData(renderer); } void mitk::FiberBundleMapper3D::SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite) { Superclass::SetDefaultProperties(node, renderer, overwrite); node->AddProperty( "opacity", mitk::FloatProperty::New( 1.0 ), renderer, overwrite); node->AddProperty( "color", mitk::ColorProperty::New(1.0,1.0,1.0), renderer, overwrite); node->AddProperty( "pickable", mitk::BoolProperty::New( true ), renderer, overwrite); node->AddProperty( "shape.linewidth", mitk::IntProperty::New( true ), renderer, overwrite ); node->AddProperty( "shape.tuberadius",mitk::FloatProperty::New( 0.0 ), renderer, overwrite); node->AddProperty( "shape.tubesides",mitk::IntProperty::New( 15 ), renderer, overwrite); node->AddProperty( "shape.ribbonwidth", mitk::FloatProperty::New( 0.0 ), renderer, overwrite); node->AddProperty( "light.enable", mitk::BoolProperty::New( true ), renderer, overwrite); node->AddProperty( "light.ambient", mitk::FloatProperty::New( 0.0 ), renderer, overwrite); node->AddProperty( "light.diffuse", mitk::FloatProperty::New( 1.0 ), renderer, overwrite); node->AddProperty( "light.specular", mitk::FloatProperty::New( 0.0 ), renderer, overwrite); node->AddProperty( "light.specularpower", mitk::FloatProperty::New( 1.0 ), renderer, overwrite); node->AddProperty( "light.ambientcolor", mitk::ColorProperty::New(1,1,1), renderer, overwrite); node->AddProperty( "light.diffusecolor", mitk::ColorProperty::New(1,1,1), renderer, overwrite); node->AddProperty( "light.specularcolor", mitk::ColorProperty::New(1,1,1), renderer, overwrite); } vtkProp* mitk::FiberBundleMapper3D::GetVtkProp(mitk::BaseRenderer *renderer) { return m_LocalStorageHandler.GetLocalStorage(renderer)->m_FiberAssembly; } void mitk::FiberBundleMapper3D::UpdateVtkObjects() { } void mitk::FiberBundleMapper3D::SetVtkMapperImmediateModeRendering(vtkMapper *) { } mitk::FiberBundleMapper3D::FBXLocalStorage3D::FBXLocalStorage3D() { m_FiberActor = vtkSmartPointer::New(); m_FiberMapper = vtkSmartPointer::New(); m_FiberAssembly = vtkSmartPointer::New(); } diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleMapper3D.h b/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleMapper3D.h index a6bb3ea8d3..c7b6b5d0d0 100644 --- a/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleMapper3D.h +++ b/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleMapper3D.h @@ -1,106 +1,101 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef FiberBundleMapper3D_H_HEADER_INCLUDED #define FiberBundleMapper3D_H_HEADER_INCLUDED //#include //?? necessary #include #include #include -#include -#include -#include - - class vtkPropAssembly; - - - +class vtkPolyDataMapper; +class vtkLookupTable; +class vtkOpenGLActor; namespace mitk { //##Documentation //## @brief Mapper for FiberBundle //## @ingroup Mapper class FiberBundleMapper3D : public VtkMapper { public: mitkClassMacro(FiberBundleMapper3D, VtkMapper) itkFactorylessNewMacro(Self) itkCloneMacro(Self) //========== essential implementation for 3D mapper ======== const FiberBundle* GetInput(); virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer); //looks like depricated.. should be replaced bz GetViewProp() static void SetDefaultProperties(DataNode* node, BaseRenderer* renderer = NULL, bool overwrite = false ); static void SetVtkMapperImmediateModeRendering(vtkMapper *mapper); virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer); //========================================================= class FBXLocalStorage3D : public mitk::Mapper::BaseLocalStorage { public: /** \brief Point Actor of a 3D render window. */ vtkSmartPointer m_FiberActor; /** \brief Point Mapper of a 3D render window. */ vtkSmartPointer m_FiberMapper; vtkSmartPointer m_FiberAssembly; /** \brief Timestamp of last update of stored data. */ itk::TimeStamp m_LastUpdateTime; /** \brief Constructor of the local storage. Do as much actions as possible in here to avoid double executions. */ FBXLocalStorage3D(); //if u copy&paste from this 2Dmapper, be aware that the implementation of this constructor is in the cpp file ~FBXLocalStorage3D() { } }; /** \brief This member holds all three LocalStorages for the 3D render window(s). */ mitk::LocalStorageHandler m_LocalStorageHandler; protected: FiberBundleMapper3D(); virtual ~FiberBundleMapper3D(); void InternalGenerateData(mitk::BaseRenderer *renderer); void UpdateVtkObjects(); //?? private: vtkSmartPointer m_lut; float m_TubeRadius; int m_TubeSides; int m_LineWidth; float m_RibbonWidth; bool m_Lighting; }; } // end namespace mitk #endif /* FiberBundleMapper3D_H_HEADER_INCLUDED */ diff --git a/Modules/IOExt/CMakeLists.txt b/Modules/IOExt/CMakeLists.txt index 6b5ac9c4ca..b5c6ac42c6 100644 --- a/Modules/IOExt/CMakeLists.txt +++ b/Modules/IOExt/CMakeLists.txt @@ -1,5 +1,5 @@ MITK_CREATE_MODULE(DEPENDS MitkDataTypesExt MitkMapperExt MitkSceneSerialization MitkLegacyIO - PACKAGE_DEPENDS VTK|vtkIOPLY+vtkIOExport + PACKAGE_DEPENDS VTK|vtkIOPLY+vtkIOExport+vtkIOParallelXML WARNINGS_AS_ERRORS AUTOLOAD_WITH MitkCore ) diff --git a/Modules/MapperExt/src/vtkUnstructuredGridMapper.cpp b/Modules/MapperExt/src/vtkUnstructuredGridMapper.cpp index 58b02226e0..89b07f5cef 100644 --- a/Modules/MapperExt/src/vtkUnstructuredGridMapper.cpp +++ b/Modules/MapperExt/src/vtkUnstructuredGridMapper.cpp @@ -1,230 +1,231 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "vtkUnstructuredGridMapper.h" #include "vtkGeometryFilter.h" #include "vtkExecutive.h" #include "vtkGarbageCollector.h" #include "vtkInformation.h" #include "vtkObjectFactory.h" #include "vtkPolyData.h" #include "vtkPolyDataMapper.h" +#include "vtkScalarsToColors.h" #include "vtkUnstructuredGrid.h" vtkStandardNewMacro(vtkUnstructuredGridMapper); //---------------------------------------------------------------------------- vtkUnstructuredGridMapper::vtkUnstructuredGridMapper() { this->GeometryExtractor = 0; this->PolyDataMapper = 0; } //---------------------------------------------------------------------------- vtkUnstructuredGridMapper::~vtkUnstructuredGridMapper() { // delete internally created objects. if ( this->GeometryExtractor ) { this->GeometryExtractor->Delete(); } if ( this->PolyDataMapper ) { this->PolyDataMapper->Delete(); } } void vtkUnstructuredGridMapper::SetBoundingObject(mitk::BoundingObject* bo) { m_BoundingObject = bo; } //---------------------------------------------------------------------------- void vtkUnstructuredGridMapper::SetInput(vtkUnstructuredGrid *input) { this->SetInputDataObject(input); } //---------------------------------------------------------------------------- vtkUnstructuredGrid *vtkUnstructuredGridMapper::GetInput() { //return this->Superclass::GetInputAsDataSet(); return vtkUnstructuredGrid::SafeDownCast( this->GetExecutive()->GetInputData(0, 0)); } //---------------------------------------------------------------------------- void vtkUnstructuredGridMapper::ReleaseGraphicsResources( vtkWindow *renWin ) { if (this->PolyDataMapper) { this->PolyDataMapper->ReleaseGraphicsResources( renWin ); } } //---------------------------------------------------------------------------- void vtkUnstructuredGridMapper::ReleaseGraphicsResources( mitk::BaseRenderer * renderer ) { if (this->PolyDataMapper) { this->PolyDataMapper->ReleaseGraphicsResources( renderer->GetVtkRenderer()->GetRenderWindow()); } } //---------------------------------------------------------------------------- // Receives from Actor -> maps data to primitives // void vtkUnstructuredGridMapper::Render(vtkRenderer *ren, vtkActor *act) { // make sure that we've been properly initialized // if ( !this->GetInput() ) { vtkErrorMacro(<< "No input!\n"); return; } // Need a lookup table // if ( this->LookupTable == 0 ) { this->CreateDefaultLookupTable(); } this->LookupTable->Build(); // Now can create appropriate mapper // if ( this->PolyDataMapper == 0 ) { vtkGeometryFilter *gf = vtkGeometryFilter::New(); vtkPolyDataMapper *pm = vtkPolyDataMapper::New(); pm->SetInputConnection(gf->GetOutputPort()); this->GeometryExtractor = gf; this->PolyDataMapper = pm; } // share clipping planes with the PolyDataMapper // if (this->ClippingPlanes != this->PolyDataMapper->GetClippingPlanes()) { this->PolyDataMapper->SetClippingPlanes(this->ClippingPlanes); } if (this->m_BoundingObject) { mitk::BoundingBox::BoundsArrayType bounds = this->m_BoundingObject->GetGeometry()->CalculateBoundingBoxRelativeToTransform(0)->GetBounds(); this->GeometryExtractor->SetExtent(bounds[0], bounds[1], bounds[2], bounds[3], bounds[4], bounds[5]); this->GeometryExtractor->ExtentClippingOn(); } else { this->GeometryExtractor->ExtentClippingOff(); } this->GeometryExtractor->SetInputData(this->GetInput()); this->PolyDataMapper->SetInputConnection(this->GeometryExtractor->GetOutputPort()); // update ourselves in case something has changed this->PolyDataMapper->SetLookupTable(this->GetLookupTable()); this->PolyDataMapper->SetScalarVisibility(this->GetScalarVisibility()); this->PolyDataMapper->SetUseLookupTableScalarRange( this->GetUseLookupTableScalarRange()); this->PolyDataMapper->SetScalarRange(this->GetScalarRange()); this->PolyDataMapper->SetImmediateModeRendering( this->GetImmediateModeRendering()); this->PolyDataMapper->SetColorMode(this->GetColorMode()); this->PolyDataMapper->SetInterpolateScalarsBeforeMapping( this->GetInterpolateScalarsBeforeMapping()); this->PolyDataMapper->SetScalarMode(this->GetScalarMode()); if ( this->ScalarMode == VTK_SCALAR_MODE_USE_POINT_FIELD_DATA || this->ScalarMode == VTK_SCALAR_MODE_USE_CELL_FIELD_DATA ) { if ( this->ArrayAccessMode == VTK_GET_ARRAY_BY_ID ) { this->PolyDataMapper->ColorByArrayComponent(this->ArrayId,ArrayComponent); } else { this->PolyDataMapper->ColorByArrayComponent(this->ArrayName,ArrayComponent); } } this->PolyDataMapper->Render(ren,act); this->TimeToDraw = this->PolyDataMapper->GetTimeToDraw(); } //---------------------------------------------------------------------------- void vtkUnstructuredGridMapper::PrintSelf(ostream& os, vtkIndent indent) { this->Superclass::PrintSelf(os,indent); if ( this->PolyDataMapper ) { os << indent << "Poly Mapper: (" << this->PolyDataMapper << ")\n"; } else { os << indent << "Poly Mapper: (none)\n"; } if ( this->GeometryExtractor ) { os << indent << "Geometry Extractor: (" << this->GeometryExtractor << ")\n"; } else { os << indent << "Geometry Extractor: (none)\n"; } } //---------------------------------------------------------------------------- unsigned long vtkUnstructuredGridMapper::GetMTime() { unsigned long mTime=this->vtkMapper::GetMTime(); unsigned long time; if ( this->LookupTable != NULL ) { time = this->LookupTable->GetMTime(); mTime = ( time > mTime ? time : mTime ); } return mTime; } //---------------------------------------------------------------------------- int vtkUnstructuredGridMapper::FillInputPortInformation( int vtkNotUsed(port), vtkInformation* info) { info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkUnstructuredGrid"); return 1; } //---------------------------------------------------------------------------- void vtkUnstructuredGridMapper::ReportReferences(vtkGarbageCollector* collector) { this->Superclass::ReportReferences(collector); // These filters share our input and are therefore involved in a // reference loop. vtkGarbageCollectorReport(collector, this->GeometryExtractor, "GeometryExtractor"); vtkGarbageCollectorReport(collector, this->PolyDataMapper, "PolyDataMapper"); }