Commit 1ad3b039 authored by arnaud.charnoz@gmail.com's avatar arnaud.charnoz@gmail.com
Browse files

merge from default to fw4spl_0.6

--HG--
branch : fw4spl_0.6
parents c21ca154 61023868
......@@ -5,3 +5,4 @@ f3dad8e5c26f18c1ed450b73e829a6e4b86f4b27 fw4spl_0.5.0
0000000000000000000000000000000000000000 fw4spl_0.5.0
a2c98d22c36d6997b1b191a1610af97b41a4677a fw4spl_0.5.0
f293a4a4fc6c976beeca6afd4f6280baab2f2e29 experimental_0.1.0
cab8f119d12758e8e2463e6644e88b73203ce76a fw4spl_0.5.2
......@@ -16,7 +16,8 @@
#include <fwData/Image.hpp>
#include <fwData/Composite.hpp>
#include "fwComEd/PatientDBMsg.hpp"
#include "fwComEd/PatientDBMsg.hpp"
#include "fwComEd/Dictionary.hpp"
#include "fwComEd/fieldHelper/AnonymiseImage.hpp"
namespace fwComEd
......@@ -76,7 +77,9 @@ void AnonymiseImage::anonymiseAcquisition( ::fwData::Acquisition::sptr _pAcquisi
{
::fwData::Patient::NewSptr pNewPatient;
(* pNewPatient) = (* _pPatient);
pNewPatient->setField( ::fwData::Patient::ID_STUDIES );
pNewPatient->setField( ::fwData::Patient::ID_STUDIES );
std::map< ::fwData::Acquisition::sptr, ::fwData::Acquisition::sptr > acquisitionMap;
::fwData::Patient::StudyIterator studiesIter = _pPatient->getStudies().first;
for ( ; studiesIter != _pPatient->getStudies().second ; ++studiesIter)
......@@ -95,9 +98,32 @@ void AnonymiseImage::anonymiseAcquisition( ::fwData::Acquisition::sptr _pAcquisi
::fwData::Acquisition::NewSptr pNewAcquisition;
pNewStudy->addAcquisition(pNewAcquisition);
(* pNewAcquisition) = (*pAcquisition);
(* pNewAcquisition) = (*pAcquisition);
acquisitionMap[pAcquisition] = pNewAcquisition;
}
}
}
::fwData::Composite::sptr ctool = ::fwData::Composite::dynamicCast(_pPatient->getTool(::fwComEd::Dictionary::m_resectionId));
if (ctool )
{
pNewPatient->addTool(::fwComEd::Dictionary::m_resectionId, ctool );
}
::fwData::Composite::sptr cscenario = ::fwData::Composite::dynamicCast( _pPatient->getScenario("ResectionAcquisitionPair"));
if ( cscenario )
{
::fwData::Composite::NewSptr compoScenario;
::fwData::Composite::Container::iterator cscenarioIter;
for ( cscenarioIter = cscenario->getRefMap().begin() ; cscenarioIter != cscenario->getRefMap().end(); ++cscenarioIter )
{
std::string opName = cscenarioIter->first;
::fwData::Acquisition::sptr initialAcq = ::fwData::Acquisition::dynamicCast(cscenario->getRefMap()[opName]);
compoScenario->getRefMap()[opName] = acquisitionMap[initialAcq];
}
pNewPatient->addScenario("ResectionAcquisitionPair", compoScenario );
}
AnonymiseImage::anonymisePatient(pNewPatient);
return pNewPatient;
......
......@@ -30,6 +30,13 @@ public:
/// override processing of childs : scan breath first ( aka fields[0] , fields[1] , ...)
FWDATA_API virtual void next( ::fwTools::Object::sptr src, ::fwTools::Object::ChildContainer &fields);
protected :
/// store src,child to process in a fifo queue
typedef ::fwTools::Object::sptr Source;
typedef ::fwTools::Object::sptr Child;
std::list< std::pair< Source ,Child > > m_fifo;
};
} // namespace visitor
......
......@@ -15,33 +15,28 @@ namespace fwData
namespace visitor
{
void BreathFirst::next(::fwTools::Object::sptr src, ::fwTools::Object::ChildContainer &fields)
{
// store fields+source : static variable !!
typedef ::fwTools::Object::sptr Source;
typedef ::fwTools::Object::sptr Child;
static std::list< std::pair< Source ,Child > > fifo;
// insert ONLY ONCE child in breathFirst order+source
::fwTools::Object::ChildContainer::iterator f;
for (f = fields.begin(); f != fields.end() ; ++f)
{
assert( ::fwTools::Object::dynamicCast( *f ) );
std::pair< Source , Child > key( src, ::fwTools::Object::dynamicCast( *f ) );
if ( std::find( fifo.begin(), fifo.end(), key )==fifo.end() )
if ( std::find( m_fifo.begin(), m_fifo.end(), key )==m_fifo.end() )
{
// not already inserted
fifo.push_back(key );
m_fifo.push_back(key );
}
}
// process list
while ( !fifo.empty() )
while ( !m_fifo.empty() )
{
m_source = fifo.front().first;
Child achild= fifo.front().second;
fifo.pop_front();
m_source = m_fifo.front().first;
Child achild= m_fifo.front().second;
m_fifo.pop_front();
accept( achild, this );
}
}
......
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