fw4spl
src/fwMedData/ImageSeries.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/ImageSeries.hpp"
8 
9 #include <fwData/Exception.hpp>
10 #include <fwData/Image.hpp>
11 #include <fwData/registry/macros.hpp>
12 
13 fwDataRegisterMacro( ::fwMedData::ImageSeries );
14 
15 namespace fwMedData
16 {
17 
19  Series(key)
20 {
21 }
22 
23 //------------------------------------------------------------------------------
24 
26 {
27 }
28 
29 //------------------------------------------------------------------------------
30 
31 void ImageSeries::shallowCopy(const ::fwData::Object::csptr& _source)
32 {
33  ImageSeries::csptr other = ImageSeries::dynamicConstCast(_source);
34  FW_RAISE_EXCEPTION_IF( ::fwData::Exception(
35  "Unable to copy" + (_source ? _source->getClassname() : std::string("<NULL>"))
36  + " to " + this->getClassname()), !bool(other) );
37 
38  this->::fwMedData::Series::shallowCopy(_source);
39 
40  m_image = other->m_image;
41  m_dicomReference = other->m_dicomReference;
42 }
43 
44 //------------------------------------------------------------------------------
45 
46 void ImageSeries::cachedDeepCopy(const ::fwData::Object::csptr& _source, DeepCopyCacheType& cache)
47 {
48  ImageSeries::csptr other = ImageSeries::dynamicConstCast(_source);
49  FW_RAISE_EXCEPTION_IF( ::fwData::Exception(
50  "Unable to copy" + (_source ? _source->getClassname() : std::string("<NULL>"))
51  + " to " + this->getClassname()), !bool(other) );
52 
53  this->::fwMedData::Series::cachedDeepCopy(_source, cache);
54 
55  m_image = ::fwData::Object::copy(other->m_image);
56  m_dicomReference = ::fwData::Object::copy(other->m_dicomReference);
57 }
58 
59 //------------------------------------------------------------------------------
60 
61 } // namespace fwMedData
::fwMedData::DicomSeries::sptr m_dicomReference
Dicom reference used to generate a valid Dicom Segmentation.
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 ImageSeries(::fwData::Object::Key key)
Constructor.
virtual FWMEDDATA_API ~ImageSeries() override
Destructor.
FWMEDDATA_API void cachedDeepCopy(const ::fwData::Object::csptr &_source, DeepCopyCacheType &cache) override
Defines deep copy.
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.
std::shared_ptr< ::fwData::Image > m_image
Image container.
virtual const std::string & getClassname() const override
return full object&#39;s classname with its namespace, i.e. fwCore::BaseObject
FWMEDDATA_API void shallowCopy(const ::fwData::Object::csptr &_source) override
Defines shallow copy.
FWMEDDATA_API void shallowCopy(const ::fwData::Object::csptr &_source) override
Defines shallow copy.