Commit 65f9ef43 authored by Valentin Martinet's avatar Valentin Martinet
Browse files

Added volume in Reconstruction, fixed copy, updated adaptor

--HG--
branch : fw4spl_0.9.2
parent 596532ab
/* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2009-2012.
* FW4SPL - Copyright (C) IRCAD, 2009-2014.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
......@@ -34,9 +34,15 @@ public:
VISUVTKADAPTOR_API void setForceHide(bool hide);
/// Set underlying actor visible or not
VISUVTKADAPTOR_API void setVisibility(bool visible);
/// Active/Inactive automatic reset on camera for triangular mesh adaptor. By default =true.
VISUVTKADAPTOR_API void setAutoResetCamera(bool autoResetCamera);
/// Retrieve a weak_ptr on underlying mesh adaptor service
::fwRenderVTK::IVtkAdaptorService::wptr getMeshService() const { return m_meshService; }
protected:
VISUVTKADAPTOR_API void doStart() throw(fwTools::Failed);
......
/* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2009-2013.
* FW4SPL - Copyright (C) IRCAD, 2009-2014.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
......@@ -208,6 +208,15 @@ void Reconstruction::doStop() throw(fwTools::Failed)
//------------------------------------------------------------------------------
void Reconstruction::setForceHide(bool hide)
{
::fwData::Reconstruction::sptr reconstruction = this->getObject < ::fwData::Reconstruction >();
this->setVisibility((hide ? false : reconstruction->getIsVisible()));
}
//------------------------------------------------------------------------------
void Reconstruction::setVisibility(bool visible)
{
SLM_TRACE_FUNC();
if (!m_meshService.expired())
......@@ -218,8 +227,7 @@ void Reconstruction::setForceHide(bool hide)
if (meshAdaptor)
{
::fwData::Reconstruction::sptr reconstruction = this->getObject < ::fwData::Reconstruction >();
meshAdaptor->updateVisibility( hide ? false : reconstruction->getIsVisible() );
meshAdaptor->updateVisibility( visible );
}
this->setVtkPipelineModified();
}
......
......@@ -50,6 +50,8 @@ public:
/// Defines deep copy
FWDATA_API void cachedDeepCopy(const Object::csptr& _source, DeepCopyCacheType &cache);
/// Constant to inform that mask volume has not been computed yet.
FWDATA_API static const double s_NO_COMPUTED_MASK_VOLUME;
// Generator result---------------------------------------------------------
fwGettersSettersDocMacro(IsVisible, bIsVisible, bool, the visibility of the reconstruction (true if visible));
......@@ -73,6 +75,11 @@ public:
*/
fwDataGetSetSptrMacro(Material, SPTR(::fwData::Material));
/**
* @brief Get/Set the volume from mask
*/
fwDataGetSetMacro(ComputedMaskVolume, double);
protected :
//! true if this reconstruction is visible
......@@ -96,6 +103,9 @@ protected :
//! Reconstruction's mesh
SPTR(::fwData::Mesh) m_attrMesh;
//! Reconstruction's mask volume
double m_attrComputedMaskVolume;
};
} // namespace fwData
......
/* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2009-2012.
* FW4SPL - Copyright (C) IRCAD, 2009-2014.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
......@@ -19,7 +19,6 @@ namespace fwData
Color::Color ( ::fwData::Object::Key key )
{
SLM_TRACE_FUNC();
m_vRGBA[0] = 1.0;
m_vRGBA[1] = 1.0;
m_vRGBA[2] = 1.0;
......@@ -41,7 +40,6 @@ Color::sptr Color::ColorFactory(Color::ColorType red, Color::ColorType green, Co
Color::~Color ()
{
SLM_TRACE_FUNC();
}
......
/* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2009-2012.
* FW4SPL - Copyright (C) IRCAD, 2009-2014.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
......@@ -22,13 +22,11 @@ namespace fwData
Composite::Composite( ::fwData::Object::Key key )
{
SLM_TRACE_FUNC();
}
Composite::~Composite()
{
SLM_TRACE_FUNC();
}
......
/* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2009-2013.
* FW4SPL - Copyright (C) IRCAD, 2009-2014.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
......@@ -20,13 +20,16 @@ fwDataRegisterMacro( ::fwData::Reconstruction );
namespace fwData
{
const double Reconstruction::s_NO_COMPUTED_MASK_VOLUME = -1.;
//------------------------------------------------------------------------------
Reconstruction::Reconstruction(::fwData::Object::Key key) :
m_bIsVisible(false),
m_sOrganName(""),
m_sStructureType(""),
m_attrMaterial( ::fwData::factory::New< ::fwData::Material>() )
m_attrMaterial( ::fwData::factory::New< ::fwData::Material>() ),
m_attrComputedMaskVolume(Reconstruction::s_NO_COMPUTED_MASK_VOLUME)
{
SLM_TRACE_FUNC();
}
......@@ -55,6 +58,8 @@ void Reconstruction::shallowCopy(const Object::csptr &_source )
m_attrMaterial = other->m_attrMaterial;
m_attrImage = other->m_attrImage;
m_attrMesh = other->m_attrMesh;
m_attrComputedMaskVolume = other->m_attrComputedMaskVolume;
}
//------------------------------------------------------------------------------
......@@ -74,6 +79,8 @@ void Reconstruction::cachedDeepCopy(const Object::csptr &_source, DeepCopyCacheT
m_attrMaterial = ::fwData::Object::copy(other->m_attrMaterial, cache);
m_attrImage = ::fwData::Object::copy(other->m_attrImage, cache);
m_attrMesh = ::fwData::Object::copy(other->m_attrMesh, cache);
m_attrComputedMaskVolume = other->m_attrComputedMaskVolume;
}
//------------------------------------------------------------------------------
......
/* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2009-2013.
* FW4SPL - Copyright (C) IRCAD, 2009-2014.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
......@@ -10,7 +10,7 @@
fwCampImplementDataMacro((fwData)(Reconstruction))
{
builder
.tag("object_version", "2")
.tag("object_version", "3")
.tag("lib_name", "fwData")
.base< ::fwData::Object>()
.property("is_visible", &::fwData::Reconstruction::m_bIsVisible)
......@@ -19,5 +19,6 @@ fwCampImplementDataMacro((fwData)(Reconstruction))
.property("material", &::fwData::Reconstruction::m_attrMaterial)
.property("image", &::fwData::Reconstruction::m_attrImage)
.property("mesh", &::fwData::Reconstruction::m_attrMesh)
.property("volume", &::fwData::Reconstruction::m_attrComputedMaskVolume)
;
}
/* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2009-2013.
* FW4SPL - Copyright (C) IRCAD, 2009-2014.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
......@@ -173,7 +173,6 @@ void RecursiveLock::visit(const camp::UserProperty& property)
void RecursiveLock::visit(const camp::Function& function)
{
SLM_TRACE_FUNC();
}
//-----------------------------------------------------------------------------
......
{
"context" : "MedicalData",
"origin_version" : "V04AFG",
"target_version" : "V05AFG",
"patcher" : "DefaultPatcher",
"links" : [
{
"::fwData::Reconstruction" : "2",
"::fwData::Reconstruction" : "3"
}
]
}
{
"context": "MedicalData",
"version_name": "V05AFG",
"versions":
{
"::fwData::Array": "1",
"::fwData::Boolean": "1",
"::fwData::Camera": "2",
"::fwData::Color": "1",
"::fwData::Composite": "1",
"::fwData::Edge": "1",
"::fwData::Float": "1",
"::fwData::Graph": "1",
"::fwData::Histogram": "1",
"::fwData::Image": "2",
"::fwData::Integer": "1",
"::fwData::Line": "1",
"::fwData::List": "1",
"::fwData::Material": "1",
"::fwData::Mesh": "2",
"::fwData::Model": "1",
"::fwData::Node": "1",
"::fwData::Plane": "1",
"::fwData::PlaneList": "1",
"::fwData::Point": "1",
"::fwData::PointList": "1",
"::fwData::Port": "1",
"::fwData::ProcessObject": "1",
"::fwData::ROITraits": "1",
"::fwData::Reconstruction": "3",
"::fwData::ReconstructionTraits": "1",
"::fwData::Resection": "1",
"::fwData::ResectionDB": "1",
"::fwData::String": "1",
"::fwData::StructureTraits": "1",
"::fwData::StructureTraitsDictionary": "1",
"::fwData::Tag": "1",
"::fwData::TransferFunction": "1",
"::fwData::TransformationMatrix3D": "1",
"::fwData::Vector": "1",
"::fwData::Video": "1",
"::fwData::location::Folder": "1",
"::fwData::location::SingleFile": "1",
"::fwMedData::ActivitySeries": "1",
"::fwMedData::Equipment": "1",
"::fwMedData::ImageSeries": "1",
"::fwMedData::ModelSeries": "1",
"::fwMedData::Patient": "1",
"::fwMedData::Series": "1",
"::fwMedData::SeriesDB": "1",
"::fwMedData::Study": "1"
}
}
/* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2009-2014.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
#ifndef __FWSTRUCTURALPATCH_FWDATA_RECONSTRUCTION_V2TOV3_HPP__
#define __FWSTRUCTURALPATCH_FWDATA_RECONSTRUCTION_V2TOV3_HPP__
#include <fwAtomsPatch/IStructuralPatch.hpp>
#include "fwStructuralPatch/config.hpp"
namespace fwStructuralPatch
{
namespace fwData
{
namespace Reconstruction
{
/// Structural patch to convert a fwData::Reconstruction from version '2' to version '3'.
class FWSTRUCTURALPATCH_CLASS_API V2ToV3 : public ::fwAtomsPatch::IStructuralPatch
{
public:
fwCoreClassDefinitionsWithFactoryMacro(
(V2ToV3)(::fwStructuralPatch::fwData::Reconstruction::V2ToV3), (()), new V2ToV3) ;
/// Constructor
FWSTRUCTURALPATCH_API V2ToV3();
/// Destructor
FWSTRUCTURALPATCH_API ~V2ToV3();
/// Copy constructor
FWSTRUCTURALPATCH_API V2ToV3( const V2ToV3 &cpy );
/**
* @brief Applies patch
*
* Removes attributes from reconstruction.
*/
FWSTRUCTURALPATCH_API virtual void apply(
const ::fwAtoms::Object::sptr& previous,
const ::fwAtoms::Object::sptr& current,
::fwAtomsPatch::IPatch::NewVersionsType& newVersions);
};
} // namespace Reconstruction
} // namespace fwData
} // namespace fwStructuralPatch
#endif /* __FWSTRUCTURALPATCH_FWDATA_RECONSTRUCTION_V2TOV3_HPP__ */
......@@ -8,6 +8,7 @@
#include <fwAtomsPatch/StructuralPatchDB.hpp>
#include "fwStructuralPatch/fwData/Reconstruction/V1ToV2.hpp"
#include "fwStructuralPatch/fwData/Reconstruction/V2ToV3.hpp"
#include "fwStructuralPatch/fwData/Patient/V1ToFwMedDataPatientV1.hpp"
#include "fwStructuralPatch/fwData/Study/V1ToFwMedDataStudyV1.hpp"
#include "fwStructuralPatch/fwData/Acquisition/V1ToFwMedDataImageSeriesV1.hpp"
......@@ -24,6 +25,7 @@ struct runner
{
::fwAtomsPatch::StructuralPatchDB::sptr structuralPatches = ::fwAtomsPatch::StructuralPatchDB::getDefault();
structuralPatches->registerPatch(::fwStructuralPatch::fwData::Reconstruction::V1ToV2::New());
structuralPatches->registerPatch(::fwStructuralPatch::fwData::Reconstruction::V2ToV3::New());
structuralPatches->registerPatch(::fwStructuralPatch::fwData::Patient::V1ToFwMedDataPatientV1::New());
structuralPatches->registerPatch(::fwStructuralPatch::fwData::Study::V1ToFwMedDataStudyV1::New());
structuralPatches->registerPatch(::fwStructuralPatch::fwData::Acquisition::V1ToFwMedDataImageSeriesV1::New());
......
/* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2009-2014.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
#include <fwAtoms/Numeric.hpp>
#include <fwAtoms/Numeric.hxx>
#include <fwAtoms/String.hpp>
#include "fwStructuralPatch/fwData/Reconstruction/V2ToV3.hpp"
namespace fwStructuralPatch
{
namespace fwData
{
namespace Reconstruction
{
V2ToV3::V2ToV3() : ::fwAtomsPatch::IStructuralPatch()
{
m_originClassname = "::fwData::Reconstruction";
m_targetClassname = "::fwData::Reconstruction";
m_originVersion = "2";
m_targetVersion = "3";
}
// ----------------------------------------------------------------------------
V2ToV3::~V2ToV3()
{
}
// ----------------------------------------------------------------------------
V2ToV3::V2ToV3( const V2ToV3 &cpy ) : ::fwAtomsPatch::IStructuralPatch(cpy)
{
}
// ----------------------------------------------------------------------------
void V2ToV3::apply(
const ::fwAtoms::Object::sptr& previous,
const ::fwAtoms::Object::sptr& current,
::fwAtomsPatch::IPatch::NewVersionsType& newVersions)
{
IStructuralPatch::apply(previous, current, newVersions);
// Update object version
this->updateVersion(current);
// Create helper
::fwAtomsPatch::helper::Object helper(current);
// Set to -1 to inform that no mask has been computed yet (::fwData::Reconstruction::s_NO_COMPUTED_MASK_VOLUME)
helper.addAttribute("volume", ::fwAtoms::Numeric::New<double>(-1.));
}
} // namespace Reconstruction
} // namespace fwData
} // namespace fwStructuralPatch
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment