Ejemplo n.º 1
0
void DicomSeries::cachedDeepCopy(const ::fwData::Object::csptr& _source, DeepCopyCacheType& cache)
{
    DicomSeries::csptr other = DicomSeries::dynamicConstCast(_source);
    FW_RAISE_EXCEPTION_IF( ::fwData::Exception(
                               "Unable to copy" + (_source ? _source->getClassname() : std::string("<NULL>"))
                               + " to " + this->getClassname()), !bool(other) );

    this->::fwMedData::Series::cachedDeepCopy(_source, cache);

    m_numberOfInstances   = other->m_numberOfInstances;
    m_SOPClassUIDs        = other->m_SOPClassUIDs;
    m_computedTagValues   = other->m_computedTagValues;
    m_firstInstanceNumber = other->m_firstInstanceNumber;

    m_dicomContainer.clear();
    for(const auto& elt : other->m_dicomContainer)
    {
        const ::fwMemory::BufferObject::sptr& bufferSrc = elt.second;
        ::fwMemory::BufferObject::Lock lockerSource(bufferSrc);

        if( !bufferSrc->isEmpty() )
        {
            ::fwMemory::BufferObject::sptr bufferDest = ::fwMemory::BufferObject::New();
            ::fwMemory::BufferObject::Lock lockerDest(bufferDest);

            bufferDest->allocate(bufferSrc->getSize());

            char* buffDest = static_cast< char* >( lockerDest.getBuffer() );
            char* buffSrc  = static_cast< char* >( lockerSource.getBuffer() );
            std::copy(buffSrc, buffSrc + bufferSrc->getSize(), buffDest );

            m_dicomContainer[elt.first] = bufferDest;
        }
    }
}
Ejemplo n.º 2
0
void InsertSeries::cachedDeepCopy(const ::fwData::Object::csptr &_source, DeepCopyCacheType &cache)
{
    InsertSeries::csptr other = InsertSeries::dynamicConstCast(_source);
    FW_RAISE_EXCEPTION_IF( ::fwData::Exception(
            "Unable to copy" + (_source?_source->getClassname():std::string("<NULL>"))
            + " to " + this->getClassname()), !bool(other) );

    this->::fwMedData::Series::cachedDeepCopy(_source, cache);
}
Ejemplo n.º 3
0
void Equipment::cachedDeepCopy(const ::fwData::Object::csptr &_source, DeepCopyCacheType &cache)
{
    Equipment::csptr other = Equipment::dynamicConstCast(_source);
    FW_RAISE_EXCEPTION_IF( ::fwData::Exception(
            "Unable to copy" + (_source?_source->getClassname():std::string("<NULL>"))
            + " to " + this->getClassname()), !bool(other) );

    this->fieldDeepCopy( _source, cache );
    m_attrInstitutionName = other->m_attrInstitutionName;
}
Ejemplo n.º 4
0
void ActivitySeries::shallowCopy(const ::fwData::Object::csptr &_source)
{
    ActivitySeries::csptr other = ActivitySeries::dynamicConstCast(_source);
    FW_RAISE_EXCEPTION_IF( ::fwData::Exception(
            "Unable to copy" + (_source?_source->getClassname():std::string("<NULL>"))
            + " to " + this->getClassname()), !bool(other) );

    this->::fwMedData::Series::shallowCopy(_source);
    m_attrActivityConfigId = other->m_attrActivityConfigId;
    m_attrData = other->m_attrData;
}
Ejemplo n.º 5
0
::igtl::MessageBase::Pointer DataConverter::fromFwObject(::fwData::Object::csptr src) const
{
    const std::string classname = src->getClassname();
    for(const converter::IConverter::sptr& converter :  m_converters)
    {
        if (converter->getFwDataObjectType() == classname)
        {
            ::fwCore::mt::ReadLock lock(src->getMutex());
            return converter->fromFwDataObject(src);
        }
    }
    return m_defaultConverter->fromFwDataObject(src);
}
Ejemplo n.º 6
0
void DicomSeries::shallowCopy(const ::fwData::Object::csptr& _source)
{
    DicomSeries::csptr other = DicomSeries::dynamicConstCast(_source);
    FW_RAISE_EXCEPTION_IF( ::fwData::Exception(
                               "Unable to copy" + (_source ? _source->getClassname() : std::string("<NULL>"))
                               + " to " + this->getClassname()), !bool(other) );

    this->::fwMedData::Series::shallowCopy(_source);

    m_numberOfInstances   = other->m_numberOfInstances;
    m_dicomContainer      = other->m_dicomContainer;
    m_SOPClassUIDs        = other->m_SOPClassUIDs;
    m_computedTagValues   = other->m_computedTagValues;
    m_firstInstanceNumber = other->m_firstInstanceNumber;
}
Ejemplo n.º 7
0
void Series::cachedDeepCopy(const ::fwData::Object::csptr &_source, DeepCopyCacheType &cache)
{
    Series::csptr other = Series::dynamicConstCast(_source);
    FW_RAISE_EXCEPTION_IF( ::fwData::Exception(
                               "Unable to copy" + (_source ? _source->getClassname() : std::string("<NULL>"))
                               + " to " + this->getClassname()), !bool(other) );

    this->fieldDeepCopy( other, cache );

    m_patient   = ::fwData::Object::copy(other->m_patient, cache);
    m_study     = ::fwData::Object::copy(other->m_study, cache);
    m_equipment = ::fwData::Object::copy(other->m_equipment, cache);

    m_instanceUID              = other->m_instanceUID;
    m_modality                 = other->m_modality;
    m_date                     = other->m_date;
    m_time                     = other->m_time;
    m_performingPhysiciansName = other->m_performingPhysiciansName;
    m_description              = other->m_description;
}
Ejemplo n.º 8
0
::fwData::Object::sptr Object::copy(const ::fwData::Object::csptr& source, Object::DeepCopyCacheType& cache)
{
    ::fwData::Object::sptr obj;

    if( source )
    {
        DeepCopyCacheType::const_iterator cacheItem = cache.find(source);

        if (cacheItem == cache.end())
        {
            obj = ::fwData::factory::New(source->getClassname());
            cache.insert( DeepCopyCacheType::value_type(source, obj) );
            obj->cachedDeepCopy(source, cache);
        }
        else
        {
            obj = cacheItem->second;
        }
    }

    return obj;
}