diff --git a/Core/Code/DataManagement/mitkPointSetShapeProperty.cpp b/Core/Code/DataManagement/mitkPointSetShapeProperty.cpp index 3807465638..0b273d4f9b 100644 --- a/Core/Code/DataManagement/mitkPointSetShapeProperty.cpp +++ b/Core/Code/DataManagement/mitkPointSetShapeProperty.cpp @@ -1,78 +1,78 @@ /*=================================================================== 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 "mitkPointSetShapeProperty.h" mitk::PointSetShapeProperty::PointSetShapeProperty( ) { this->AddPointSetShapes(); this->SetValue( CROSS ); } mitk::PointSetShapeProperty::PointSetShapeProperty( const IdType& value ) { this->AddPointSetShapes(); if ( IsValidEnumerationValue( value ) ) { this->SetValue( value ) ; } else MITK_WARN << "Warning: invalid point set shape"; } mitk::PointSetShapeProperty::PointSetShapeProperty( const std::string& value ) { this->AddPointSetShapes(); if ( IsValidEnumerationValue( value ) ) { this->SetValue( value ); } else MITK_WARN << "Invalid point set shape"; } -int mitk::PointSetShapeProperty::GetPointSetShape() +const int mitk::PointSetShapeProperty::GetPointSetShape() { return static_cast( this->GetValueAsId() ); } void mitk::PointSetShapeProperty::AddPointSetShapes() { AddEnum("None", NONE); AddEnum("Vertex", VERTEX); AddEnum("Dash", DASH); AddEnum("Cross", CROSS); AddEnum("ThickCross", THICK_CROSS); AddEnum("Triangle", TRIANGLE); AddEnum("Square", SQUARE); AddEnum("Circle", CIRCLE); AddEnum("Diamond", DIAMOND); AddEnum("Arrow", ARROW); AddEnum("ThickArrow", THICK_ARROW); AddEnum("HookedArrow", HOOKED_ARROW); } bool mitk::PointSetShapeProperty::AddEnum( const std::string& name, const IdType& id ) { return Superclass::AddEnum( name, id ); } itk::LightObject::Pointer mitk::PointSetShapeProperty::InternalClone() const { itk::LightObject::Pointer result(new Self(*this)); return result; } diff --git a/Core/Code/DataManagement/mitkPointSetShapeProperty.h b/Core/Code/DataManagement/mitkPointSetShapeProperty.h index 0834e2f1e5..35b2af1f9c 100644 --- a/Core/Code/DataManagement/mitkPointSetShapeProperty.h +++ b/Core/Code/DataManagement/mitkPointSetShapeProperty.h @@ -1,126 +1,126 @@ /*=================================================================== 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 _MITK_POINTSET_SHAPE_PROPERTY__H_ #define _MITK_POINTSET_SHAPE_PROPERTY__H_ #include "mitkEnumerationProperty.h" namespace mitk { #ifdef _MSC_VER # pragma warning(push) # pragma warning(disable: 4522) #endif /** * Encapsulates the enumeration for point set shapes. Valid values are: * \li NONE * \li VERTEX * \li DASH * \li CROSS (default) * \li THICK_CROSS * \li TRIANGLE * \li SQUARE * \li CIRCLE * \li DIAMOND * \li ARROW * \li THICK_ARROW * \li HOOKED_ARROW * * This class provides different shapes for the point set rendering (unselected points). * */ class MITK_CORE_EXPORT PointSetShapeProperty : public EnumerationProperty { public: mitkClassMacro( PointSetShapeProperty, EnumerationProperty ); itkNewMacro(PointSetShapeProperty); mitkNewMacro1Param(PointSetShapeProperty, const IdType&); mitkNewMacro1Param(PointSetShapeProperty, const std::string&); enum PointSetShape { NONE = 0, VERTEX = 1, DASH = 2, CROSS = 3, THICK_CROSS = 4, TRIANGLE = 5, SQUARE = 6, CIRCLE = 7, DIAMOND = 8, ARROW = 9, THICK_ARROW = 10, HOOKED_ARROW = 11 // Default = CROSS; }; /** * Returns the current shape */ - virtual int GetPointSetShape(); + virtual const int GetPointSetShape(); using BaseProperty::operator=; protected: /** Sets rendering type to default (VTK_RAY_CAST_COMPOSITE_FUNCTION). */ PointSetShapeProperty( ); /** * Constructor. Sets rendering type to the given value. */ PointSetShapeProperty( const IdType& value ); /** * Constructor. Sets rendering type to the given value. */ PointSetShapeProperty( const std::string& value ); /** * this function is overridden as protected, so that the user may not add * additional invalid rendering types. */ virtual bool AddEnum( const std::string& name, const IdType& id ); /** * Adds the default enumeration types. */ virtual void AddPointSetShapes(); private: // purposely not implemented PointSetShapeProperty& operator=(const PointSetShapeProperty&); virtual itk::LightObject::Pointer InternalClone() const; }; #ifdef _MSC_VER # pragma warning(pop) #endif } // end of namespace mitk #endif diff --git a/Core/Code/Rendering/mitkMapper.cpp b/Core/Code/Rendering/mitkMapper.cpp index 6310f2875a..185edb5c02 100644 --- a/Core/Code/Rendering/mitkMapper.cpp +++ b/Core/Code/Rendering/mitkMapper.cpp @@ -1,164 +1,164 @@ /*=================================================================== 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 "mitkMapper.h" #include "mitkDataNode.h" #include "mitkBaseRenderer.h" #include "mitkProperties.h" mitk::Mapper::Mapper() :m_TimeStep( 0 ) { } mitk::Mapper::~Mapper() { } mitk::BaseData* mitk::Mapper::GetData() const { return m_DataNode->GetData(); } mitk::DataNode* mitk::Mapper::GetDataNode() const { return this->m_DataNode.GetPointer(); } bool mitk::Mapper::GetColor(float rgb[3], mitk::BaseRenderer* renderer, const char* name) const { const mitk::DataNode* node=GetDataNode(); if(node==NULL) return false; return node->GetColor(rgb, renderer, name); } bool mitk::Mapper::GetVisibility(bool &visible, mitk::BaseRenderer* renderer, const char* name) const { const mitk::DataNode* node=GetDataNode(); if(node==NULL) return false; return node->GetVisibility(visible, renderer, name); } bool mitk::Mapper::GetOpacity(float &opacity, mitk::BaseRenderer* renderer, const char* name) const { const mitk::DataNode* node=GetDataNode(); if(node==NULL) return false; return node->GetOpacity(opacity, renderer, name); } bool mitk::Mapper::GetLevelWindow(mitk::LevelWindow& levelWindow, mitk::BaseRenderer* renderer, const char* name) const { const mitk::DataNode* node=GetDataNode(); if(node==NULL) return false; return node->GetLevelWindow(levelWindow, renderer, name); } bool mitk::Mapper::IsVisible(mitk::BaseRenderer* renderer, const char* name) const { bool visible = true; GetDataNode()->GetVisibility(visible, renderer, name); return visible; } void mitk::Mapper::CalculateTimeStep( mitk::BaseRenderer *renderer ) { if ( ( renderer != NULL ) && ( m_DataNode.GetPointer() != NULL ) ) { m_TimeStep = renderer->GetTimeStep(m_DataNode->GetData()); } else { m_TimeStep = 0; } } void mitk::Mapper::Update(mitk::BaseRenderer *renderer) { const DataNode* node = GetDataNode(); assert(node!=NULL); mitk::BaseData * data = static_cast(node->GetData()); if (!data) return; // Calculate time step of the input data for the specified renderer (integer value) this->CalculateTimeStep( renderer ); // Check if time step is valid const TimeSlicedGeometry *dataTimeGeometry = data->GetTimeSlicedGeometry(); if ( ( dataTimeGeometry == NULL ) || ( dataTimeGeometry->GetTimeSteps() == 0 ) || ( !dataTimeGeometry->IsValidTime( m_TimeStep ) ) ) { // TimeSlicedGeometry or time step is not valid for this data: // reset mapper so that nothing is displayed this->ResetMapper( renderer ); return; } this->GenerateDataForRenderer(renderer); } -bool mitk::Mapper::BaseLocalStorage::IsGenerateDataRequired( +const bool mitk::Mapper::BaseLocalStorage::IsGenerateDataRequired( mitk::BaseRenderer *renderer, mitk::Mapper *mapper, mitk::DataNode *dataNode) { if( mapper && m_LastGenerateDataTime < mapper -> GetMTime () ) return true; if( dataNode ) { if( m_LastGenerateDataTime < dataNode -> GetDataReferenceChangedTime () ) return true; mitk::BaseData * data = dataNode -> GetData ( ) ; if( data && m_LastGenerateDataTime < data -> GetMTime ( ) ) return true; } if( renderer && m_LastGenerateDataTime < renderer -> GetTimeStepUpdateTime ( ) ) return true; return false; } void mitk::Mapper::SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite) { node->AddProperty( "visible", mitk::BoolProperty::New(true), renderer, overwrite ); node->AddProperty( "layer", mitk::IntProperty::New(0), renderer, overwrite); node->AddProperty( "name", mitk::StringProperty::New("No Name!"), renderer, overwrite ); } diff --git a/Core/Code/Rendering/mitkMapper.h b/Core/Code/Rendering/mitkMapper.h index 22d98f25c4..fb1260eaf0 100644 --- a/Core/Code/Rendering/mitkMapper.h +++ b/Core/Code/Rendering/mitkMapper.h @@ -1,241 +1,241 @@ /*=================================================================== 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 MAPPER_H_HEADER_INCLUDED_C1E6EA08 #define MAPPER_H_HEADER_INCLUDED_C1E6EA08 #include #include "mitkBaseRenderer.h" #include "mitkVtkPropRenderer.h" #include "mitkLevelWindow.h" #include "mitkCommon.h" #include "mitkLocalStorageHandler.h" #include #include //Just included to get VTK version #include class vtkWindow; class vtkProp; namespace mitk { class BaseRenderer; class BaseData; class DataNode; /** \brief Base class of all mappers, Vtk as well as OpenGL mappers * * By the help of mappers, the input data is transformed to tangible primitives, * such as surfaces, points, lines, etc. * This is the base class of all mappers, Vtk as well as OpenGL mappers. * Subclasses of mitk::Mapper control the creation of rendering primitives * that interface to the graphics library (e.g., OpenGL, vtk). * * \todo Should Mapper be a subclass of ImageSource? * \ingroup Mapper */ class MITK_CORE_EXPORT Mapper : public itk::Object { public: mitkClassMacro(Mapper, itk::Object); /** \brief Set the DataNode containing the data to map */ itkSetObjectMacro(DataNode, DataNode); /** \brief Get the DataNode containing the data to map */ virtual DataNode* GetDataNode() const; /**\brief Get the data to map * * Returns the mitk::BaseData object associated with this mapper. * \return the mitk::BaseData associated with this mapper. * \deprecatedSince{2013_03} Use GetDataNode()->GetData() instead to access the data */ DEPRECATED(BaseData* GetData() const); /** \brief Convenience access method for color properties (instances of * ColorProperty) * \return \a true property was found * \deprecatedSince{2013_03} Use GetDataNode()->GetColor(...) instead to get the color */ DEPRECATED(virtual bool GetColor(float rgb[3], BaseRenderer* renderer, const char* name = "color") const); /** \brief Convenience access method for visibility properties (instances * of BoolProperty) * \return \a true property was found * \sa IsVisible * \deprecatedSince{2013_03} Use GetDataNode()->GetVisibility(...) instead to get the visibility */ DEPRECATED(virtual bool GetVisibility(bool &visible, BaseRenderer* renderer, const char* name = "visible") const); /** \brief Convenience access method for opacity properties (instances of * FloatProperty) * \return \a true property was found * \deprecatedSince{2013_03} Use GetDataNode()->GetOpacity(...) instead to get the opacity */ DEPRECATED(virtual bool GetOpacity(float &opacity, BaseRenderer* renderer, const char* name = "opacity") const); /** \brief Convenience access method for color properties (instances of * LevelWindoProperty) * \return \a true property was found * \deprecatedSince{2013_03} Use GetDataNode->GetLevelWindow(...) instead to get the levelwindow */ DEPRECATED(virtual bool GetLevelWindow(LevelWindow &levelWindow, BaseRenderer* renderer, const char* name = "levelwindow") const); /** \brief Convenience access method for visibility properties (instances * of BoolProperty). Return value is the visibility. Default is * visible==true, i.e., true is returned even if the property (\a * propertyKey) is not found. * * Thus, the return value has a different meaning than in the * GetVisibility method! * \sa GetVisibility * \deprecatedSince{2013_03} Use GetDataNode()->GetVisibility(...) instead */ DEPRECATED(virtual bool IsVisible(BaseRenderer* renderer, const char* name = "visible") const); /** \brief Returns whether this is an vtk-based mapper * \deprecatedSince{2013_03} All mappers of superclass VTKMapper are vtk based, use a dynamic_cast instead */ virtual bool IsVtkBased() const = 0; /** \brief Calls the time step of the input data for the specified renderer and checks * whether the time step is valid and calls method GenerateDataForRenderer() */ virtual void Update(BaseRenderer* renderer); /** \brief Responsible for calling the appropriate render functions. * To be implemented in sub-classes. */ virtual void MitkRender(mitk::BaseRenderer* renderer, mitk::VtkPropRenderer::RenderType type) = 0; /** * \brief Apply specific color and opacity properties read from the PropertyList. * Reimplemented in GLmapper (does not use the actor) and the VtkMapper class. * The function is called by the individual mapper (mostly in the ApplyProperties() or ApplyAllProperties() * method). */ virtual void ApplyColorAndOpacityProperties(mitk::BaseRenderer* renderer, vtkActor* actor = NULL) = 0; /** \brief Set default values of properties used by this mapper * to \a node * * \param node The node for which the properties are set * \param overwrite overwrite existing properties (default: \a false) * \param renderer defines which property list of node is used * (default: \a NULL, i.e. default property list) */ static void SetDefaultProperties(DataNode* node, BaseRenderer* renderer = NULL, bool overwrite = false); /** \brief Returns the current time step as calculated from the renderer */ int GetTimestep() const { return m_TimeStep; } /** Returns true if this Mapper currently allows for Level-of-Detail rendering. * This reflects whether this Mapper currently invokes StartEvent, EndEvent, and * ProgressEvent on BaseRenderer. */ virtual bool IsLODEnabled( BaseRenderer * /*renderer*/ ) const { return false; } protected: /** \brief explicit constructor which disallows implicit conversions */ explicit Mapper(); /** \brief virtual destructor in order to derive from this class */ virtual ~Mapper(); /** \brief Generate the data needed for rendering (independent of a specific renderer) * \deprecatedSince{2013_03} Use GenerateDataForRenderer(BaseRenderer* renderer) instead. */ DEPRECATED( virtual void GenerateData() ) { } /** \brief Generate the data needed for rendering into \a renderer */ virtual void GenerateDataForRenderer(BaseRenderer* /* renderer */) { } /** \brief Updates the time step, which is sometimes needed in subclasses */ virtual void CalculateTimeStep( BaseRenderer* renderer ); /** \brief Reset the mapper (i.e., make sure that nothing is displayed) if no * valid data is present. In most cases the reimplemented function * disables the according actors (toggling visibility off) * * To be implemented in sub-classes. */ virtual void ResetMapper( BaseRenderer* /*renderer*/ ) { } //\brief not thread-safe itk::WeakPointer m_DataNode; private: /** \brief The current time step of the dataset to be rendered, * for use in subclasses. * The current timestep can be accessed via the GetTimestep() method. */ int m_TimeStep; /** \brief copy constructor */ Mapper( const Mapper &); /** \brief assignment operator */ Mapper &operator=(const Mapper &); public: /** \brief Base class for mapper specific rendering ressources. */ class MITK_CORE_EXPORT BaseLocalStorage { public: - bool IsGenerateDataRequired(mitk::BaseRenderer *renderer,mitk::Mapper *mapper,mitk::DataNode *dataNode); + const bool IsGenerateDataRequired(mitk::BaseRenderer *renderer,mitk::Mapper *mapper,mitk::DataNode *dataNode); - inline void UpdateGenerateDataTime() + inline const void UpdateGenerateDataTime() { m_LastGenerateDataTime.Modified(); } - inline itk::TimeStamp & GetLastGenerateDataTime() { return m_LastGenerateDataTime; } + inline const itk::TimeStamp & GetLastGenerateDataTime() { return m_LastGenerateDataTime; } protected: /** \brief timestamp of last update of stored data */ itk::TimeStamp m_LastGenerateDataTime; }; }; } // namespace mitk #endif /* MAPPER_H_HEADER_INCLUDED_C1E6EA08 */ diff --git a/Core/Code/Rendering/mitkVtkMapper.cpp b/Core/Code/Rendering/mitkVtkMapper.cpp index a272fba01e..e4f925429a 100644 --- a/Core/Code/Rendering/mitkVtkMapper.cpp +++ b/Core/Code/Rendering/mitkVtkMapper.cpp @@ -1,129 +1,129 @@ /*=================================================================== 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 "mitkVtkMapper.h" mitk::VtkMapper::VtkMapper() { } mitk::VtkMapper::~VtkMapper() { } void mitk::VtkMapper::MitkRender(mitk::BaseRenderer* renderer, mitk::VtkPropRenderer::RenderType type){ switch(type) { case mitk::VtkPropRenderer::Opaque: this->MitkRenderOpaqueGeometry(renderer); break; case mitk::VtkPropRenderer::Translucent: this->MitkRenderTranslucentGeometry(renderer); break; case mitk::VtkPropRenderer::Overlay: this->MitkRenderOverlay(renderer); break; case mitk::VtkPropRenderer::Volumetric: this->MitkRenderVolumetricGeometry(renderer); break; } } bool mitk::VtkMapper::IsVtkBased() const { return true; } void mitk::VtkMapper::MitkRenderOverlay(BaseRenderer* renderer) { bool visible = true; GetDataNode()->GetVisibility(visible, renderer, "visible"); if ( !visible) return; if ( this->GetVtkProp(renderer)->GetVisibility() ) { GetVtkProp(renderer)->RenderOverlay(renderer->GetVtkRenderer()); } } void mitk::VtkMapper::MitkRenderOpaqueGeometry(BaseRenderer* renderer) { bool visible = true; GetDataNode()->GetVisibility(visible, renderer, "visible"); if ( !visible) return; if ( this->GetVtkProp(renderer)->GetVisibility() ) { GetVtkProp(renderer)->RenderOpaqueGeometry( renderer->GetVtkRenderer() ); } } void mitk::VtkMapper::MitkRenderTranslucentGeometry(BaseRenderer* renderer) { bool visible = true; GetDataNode()->GetVisibility(visible, renderer, "visible"); if ( !visible) return; if ( this->GetVtkProp(renderer)->GetVisibility() ) { GetVtkProp(renderer)->RenderTranslucentPolygonalGeometry(renderer->GetVtkRenderer()); } } void mitk::VtkMapper::MitkRenderVolumetricGeometry(BaseRenderer* renderer) { bool visible = true; GetDataNode()->GetVisibility(visible, renderer, "visible"); if ( !visible) return; if ( GetVtkProp(renderer)->GetVisibility() ) { GetVtkProp(renderer)->RenderVolumetricGeometry(renderer->GetVtkRenderer()); } } -bool mitk::VtkMapper::HasVtkProp( const vtkProp *prop, BaseRenderer *renderer ) +const bool mitk::VtkMapper::HasVtkProp( const vtkProp *prop, BaseRenderer *renderer ) { vtkProp *myProp = this->GetVtkProp( renderer ); // TODO: check if myProp is a vtkAssembly and if so, check if prop is contained in its leafs return ( prop == myProp ); } void mitk::VtkMapper::SetVtkMapperImmediateModeRendering(vtkMapper *mapper) { if(mapper) mapper->SetImmediateModeRendering(mitk::VtkPropRenderer::useImmediateModeRendering()); } void mitk::VtkMapper::UpdateVtkTransform(mitk::BaseRenderer *renderer) { vtkLinearTransform * vtktransform = GetDataNode()->GetVtkTransform(this->GetTimestep()); vtkProp3D *prop = dynamic_cast( GetVtkProp(renderer) ); if(prop) prop->SetUserTransform(vtktransform); } void mitk::VtkMapper::ApplyColorAndOpacityProperties(BaseRenderer* renderer, vtkActor* actor) { float rgba[4]={1.0f,1.0f,1.0f,1.0f}; DataNode * node = GetDataNode(); // check for color prop and use it for rendering if it exists node->GetColor(rgba, renderer, "color"); // check for opacity prop and use it for rendering if it exists node->GetOpacity(rgba[3], renderer, "opacity"); double drgba[4]={rgba[0],rgba[1],rgba[2],rgba[3]}; actor->GetProperty()->SetColor(drgba); actor->GetProperty()->SetOpacity(drgba[3]); } diff --git a/Core/Code/Rendering/mitkVtkMapper.h b/Core/Code/Rendering/mitkVtkMapper.h index 6344bcfe5d..c5b8ee68ea 100644 --- a/Core/Code/Rendering/mitkVtkMapper.h +++ b/Core/Code/Rendering/mitkVtkMapper.h @@ -1,145 +1,145 @@ /*=================================================================== 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. ===================================================================*/ // change number #ifndef VTKMAPPER_H_HEADER_INCLUDED_C1C5453B #define VTKMAPPER_H_HEADER_INCLUDED_C1C5453B #include #include "mitkMapper.h" #include "mitkBaseRenderer.h" #include "mitkDataNode.h" #include "mitkVtkPropRenderer.h" #include #include #include #include #include #include #include #include class vtkProp; class vtkProp3D; class vtkActor; namespace mitk { /** \brief Base class of all Vtk Mappers in order to display primitives * by exploiting Vtk functionality. * * Rendering of opaque, translucent or volumetric geometry and overlays * is done in consecutive render passes. * * \ingroup Mapper */ class MITK_CORE_EXPORT VtkMapper : public Mapper { public: mitkClassMacro(VtkMapper,Mapper); virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) = 0; /** \brief Re-issues all drawing commands required to describe * the entire scene each time a new frame is required, * regardless of actual changes. */ static void SetVtkMapperImmediateModeRendering(vtkMapper *mapper); /** * \brief Returns whether this is an vtk-based mapper * \deprecatedSince{2013_03} All mappers of superclass VTKMapper are vtk based, use a dynamic_cast instead */ DEPRECATED( virtual bool IsVtkBased() const ); /** \brief Determines which geometry should be rendered * (opaque, translucent, volumetric, overlay) * and calls the appropriate function. * * Called by mitk::VtkPropRenderer::Render */ void MitkRender(mitk::BaseRenderer* renderer, mitk::VtkPropRenderer::RenderType type); /** \brief Checks visibility and renders the overlay */ virtual void MitkRenderOverlay(BaseRenderer* renderer); /** \brief Checks visibility and renders untransparent geometry */ virtual void MitkRenderOpaqueGeometry(BaseRenderer* renderer); /** \brief Checks visiblity and renders transparent geometry */ virtual void MitkRenderTranslucentGeometry(BaseRenderer* renderer); /** \brief Checks visibility and renders volumes */ virtual void MitkRenderVolumetricGeometry(BaseRenderer* renderer); /** \brief Returns true if this mapper owns the specified vtkProp for * the given BaseRenderer. * * Note: returns false by default; should be implemented for VTK-based * Mapper subclasses. */ - virtual bool HasVtkProp( const vtkProp *prop, BaseRenderer *renderer ); + virtual const bool HasVtkProp( const vtkProp *prop, BaseRenderer *renderer ); /** \brief Set the vtkTransform of the m_Prop3D for * the current time step of \a renderer * * Called by mitk::VtkPropRenderer::Update before rendering */ virtual void UpdateVtkTransform(mitk::BaseRenderer *renderer); /** * \brief Apply color and opacity properties read from the PropertyList * \deprecatedSince{2013_03} Use ApplyColorAndOpacityProperties(mitk::BaseRenderer* renderer, vtkActor * actor) instead */ DEPRECATED(inline virtual void ApplyProperties(vtkActor* actor, mitk::BaseRenderer* renderer)) { ApplyColorAndOpacityProperties(renderer, actor); } /** * \brief Apply color and opacity properties read from the PropertyList. * Called by mapper subclasses. */ virtual void ApplyColorAndOpacityProperties(mitk::BaseRenderer* renderer, vtkActor * actor); /** * \brief Release vtk-based graphics resources that are being consumed by this mapper. * The parameter window could be used to determine which graphic * resources to releases. Must be overwritten in individual subclasses * if vtkProps are used. */ virtual void ReleaseGraphicsResources(vtkWindow* /*renWin*/) { }; protected: /** constructor */ VtkMapper(); /** virtual destructor in order to derive from this class */ virtual ~VtkMapper(); private: /** copy constructor */ VtkMapper( const VtkMapper &); /** assignment operator */ VtkMapper & operator=(const VtkMapper &); }; } // namespace mitk #endif /* VTKMAPPER_H_HEADER_INCLUDED_C1C5453B */ diff --git a/Modules/DiffusionImaging/DiffusionCore/Rendering/mitkCompositeMapper.h b/Modules/DiffusionImaging/DiffusionCore/Rendering/mitkCompositeMapper.h index b587249019..783546ee1f 100644 --- a/Modules/DiffusionImaging/DiffusionCore/Rendering/mitkCompositeMapper.h +++ b/Modules/DiffusionImaging/DiffusionCore/Rendering/mitkCompositeMapper.h @@ -1,159 +1,159 @@ /*=================================================================== 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 COMPOSITEMAPPER_H_HEADER_INCLUDED #define COMPOSITEMAPPER_H_HEADER_INCLUDED #include "mitkGLMapper.h" #include "mitkVtkMapper.h" #include "mitkQBallImage.h" #include "mitkImageVtkMapper2D.h" #include "mitkOdfVtkMapper2D.h" #include "mitkLevelWindowProperty.h" namespace mitk { class CopyImageMapper2D : public ImageVtkMapper2D { public: mitkClassMacro(CopyImageMapper2D,ImageVtkMapper2D); itkNewMacro(Self); friend class CompositeMapper; }; //##Documentation //## @brief Composite pattern for combination of different mappers //## @ingroup Mapper class CompositeMapper : public VtkMapper { public: mitkClassMacro(CompositeMapper,VtkMapper); itkNewMacro(Self); virtual void MitkRenderOverlay(BaseRenderer* renderer) { m_ImgMapper->MitkRenderOverlay(renderer); m_OdfMapper->MitkRenderOverlay(renderer); } virtual void MitkRenderOpaqueGeometry(BaseRenderer* renderer) { m_ImgMapper->MitkRenderOpaqueGeometry(renderer); m_OdfMapper->MitkRenderOpaqueGeometry(renderer); if( mitk::RenderingManager::GetInstance()->GetNextLOD( renderer ) == 0 ) { renderer->Modified(); } } virtual void MitkRenderTranslucentGeometry(BaseRenderer* renderer) { m_ImgMapper->MitkRenderTranslucentGeometry(renderer); m_OdfMapper->MitkRenderTranslucentGeometry(renderer); } virtual void MitkRenderVolumetricGeometry(BaseRenderer* renderer) { m_ImgMapper->MitkRenderVolumetricGeometry(renderer); m_OdfMapper->MitkRenderVolumetricGeometry(renderer); } void SetDataNode(DataNode* node) { m_DataNode = node; m_ImgMapper->SetDataNode(node); m_OdfMapper->SetDataNode(node); } mitk::ImageVtkMapper2D::Pointer GetImageMapper() { ImageVtkMapper2D* retval = m_ImgMapper; return retval; } - bool HasVtkProp( const vtkProp* prop, BaseRenderer* renderer ) + const bool HasVtkProp( const vtkProp* prop, BaseRenderer* renderer ) { return m_OdfMapper->HasVtkProp(prop, renderer); } void ReleaseGraphicsResources(vtkWindow* window) { m_ImgMapper->ReleaseGraphicsResources(window); m_OdfMapper->ReleaseGraphicsResources(window); } static void SetDefaultProperties(DataNode* node, BaseRenderer* renderer = NULL, bool overwrite = false ) { mitk::OdfVtkMapper2D::SetDefaultProperties(node, renderer, overwrite); mitk::CopyImageMapper2D::SetDefaultProperties(node, renderer, overwrite); mitk::LevelWindow opaclevwin; opaclevwin.SetRangeMinMax(0,255); opaclevwin.SetWindowBounds(0,0); mitk::LevelWindowProperty::Pointer prop = mitk::LevelWindowProperty::New(opaclevwin); node->AddProperty( "opaclevelwindow", prop ); } bool IsLODEnabled( BaseRenderer * renderer ) const { return m_ImgMapper->IsLODEnabled(renderer) || m_OdfMapper->IsLODEnabled(renderer); } vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) { vtkPropAssembly* assembly = vtkPropAssembly::New(); assembly->AddPart( m_OdfMapper->GetVtkProp(renderer)); assembly->AddPart( m_ImgMapper->GetVtkProp(renderer)); return assembly; } protected: virtual void Update(mitk::BaseRenderer* renderer) { m_OdfMapper->Update(renderer); GenerateDataForRenderer(renderer); } virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer) { m_ImgMapper->GenerateDataForRenderer(renderer); // if( mitk::RenderingManager::GetInstance()->GetNextLOD( renderer ) > 0 ) // { // m_OdfMapper->GenerateDataForRenderer(renderer); // } } CompositeMapper(); virtual ~CompositeMapper(); private: mitk::OdfVtkMapper2D::Pointer m_OdfMapper; mitk::CopyImageMapper2D::Pointer m_ImgMapper; }; } // namespace mitk #endif /* COMPOSITEMAPPER_H_HEADER_INCLUDED */