fw4spl
src/fwMedData/ModelSeries.cpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2018.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #include "fwMedData/ModelSeries.hpp"
8 
9 #include <fwCom/Signal.hpp>
10 #include <fwCom/Signal.hxx>
11 #include <fwCom/Signals.hpp>
12 
13 #include <fwData/Exception.hpp>
14 #include <fwData/Image.hpp>
15 #include <fwData/Reconstruction.hpp>
16 #include <fwData/registry/macros.hpp>
17 
18 fwDataRegisterMacro( ::fwMedData::ModelSeries );
19 
20 namespace fwMedData
21 {
22 
23 const ::fwCom::Signals::SignalKeyType ModelSeries::s_RECONSTRUCTIONS_ADDED_SIG = "reconstructionsAdded";
24 const ::fwCom::Signals::SignalKeyType ModelSeries::s_RECONSTRUCTIONS_REMOVED_SIG = "reconstructionsRemoved";
25 
27  Series(key)
28 {
29  m_sigReconstructionsAdded = ReconstructionsAddedSignalType::New();
30  m_sigReconstructionsRemoved = ReconstructionsRemovedSignalType::New();
31 
32  m_signals( s_RECONSTRUCTIONS_ADDED_SIG, m_sigReconstructionsAdded)
33  ( s_RECONSTRUCTIONS_REMOVED_SIG, m_sigReconstructionsRemoved);
34 }
35 
36 //------------------------------------------------------------------------------
37 
39 {
40 }
41 
42 //------------------------------------------------------------------------------
43 
44 void ModelSeries::shallowCopy(const ::fwData::Object::csptr& _source)
45 {
46  ModelSeries::csptr other = ModelSeries::dynamicConstCast(_source);
47  FW_RAISE_EXCEPTION_IF( ::fwData::Exception(
48  "Unable to copy" + (_source ? _source->getClassname() : std::string("<NULL>"))
49  + " to " + this->getClassname()), !bool(other) );
50 
51  this->::fwMedData::Series::shallowCopy(_source);
52 
53  m_reconstructionDB = other->m_reconstructionDB;
54  m_dicomReference = other->m_dicomReference;
55 }
56 
57 //------------------------------------------------------------------------------
58 
59 void ModelSeries::cachedDeepCopy(const ::fwData::Object::csptr& _source, DeepCopyCacheType& cache)
60 {
61  ModelSeries::csptr other = ModelSeries::dynamicConstCast(_source);
62  FW_RAISE_EXCEPTION_IF( ::fwData::Exception(
63  "Unable to copy" + (_source ? _source->getClassname() : std::string("<NULL>"))
64  + " to " + this->getClassname()), !bool(other) );
65 
66  this->::fwMedData::Series::cachedDeepCopy(_source, cache);
67 
68  m_reconstructionDB.clear();
69  for(const ::fwData::Reconstruction::sptr& rec : other->m_reconstructionDB)
70  {
71  m_reconstructionDB.push_back(::fwData::Object::copy(rec, cache));
72  }
73  m_dicomReference = ::fwData::Object::copy(other->m_dicomReference);
74 }
75 
76 //------------------------------------------------------------------------------
77 
78 } // namespace fwMedData
FWMEDDATA_API void shallowCopy(const ::fwData::Object::csptr &_source) override
Defines shallow copy.
ReconstructionVectorType m_reconstructionDB
Model container.
Namespace containing medical data.
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
Implements data exception class.
FWMEDDATA_API void cachedDeepCopy(const ::fwData::Object::csptr &_source, DeepCopyCacheType &cache) override
Defines deep copy.
FWMEDDATA_API ModelSeries(::fwData::Object::Key key)
Constructor.
FWMEDDATA_API void cachedDeepCopy(const ::fwData::Object::csptr &_source, DeepCopyCacheType &cache) override
Defines deep copy.
virtual FWMEDDATA_API ~ModelSeries() override
Destructor.
static FWMEDDATA_APIconst::fwCom::Signals::SignalKeyType s_RECONSTRUCTIONS_ADDED_SIG
Key in m_signals map of signal m_sigReconstructionsAdded.
static FWDATA_API::fwData::Object::sptr copy(const ::fwData::Object::csptr &source)
return a copy of the source. if source is a null pointer, return a null pointer.
virtual const std::string & getClassname() const override
return full object&#39;s classname with its namespace, i.e. fwCore::BaseObject
::fwMedData::DicomSeries::sptr m_dicomReference
Dicom reference used to generate a valid Dicom Segmentation Surface.
FWMEDDATA_API void shallowCopy(const ::fwData::Object::csptr &_source) override
Defines shallow copy.
static FWMEDDATA_APIconst::fwCom::Signals::SignalKeyType s_RECONSTRUCTIONS_REMOVED_SIG
Key in m_signals map of signal m_sigReconstructionsRemoved.