7 #include "fwGdcmIO/helper/DicomSeriesAnonymizer.hpp" 9 #include <fwCore/base.hpp> 11 #include <fwJobs/Aggregator.hpp> 12 #include <fwJobs/IJob.hpp> 13 #include <fwJobs/Job.hpp> 14 #include <fwJobs/Observer.hpp> 16 #include <fwMedData/SeriesDB.hpp> 18 #include <fwTools/System.hpp> 20 #include <boost/foreach.hpp> 28 m_job(::
fwJobs::Aggregator::New(
"Anonymization process"))
30 m_writer = ::fwGdcmIO::helper::DicomSeriesWriter::New();
31 m_reader = ::fwGdcmIO::reader::SeriesDB::New();
50 const ::fwMedData::DicomSeries::sptr& destination)
52 auto writerObserver =
m_writer->getJob();
54 auto readerObserver =
m_reader->getJob();
57 m_job->addSimpleCancelHook([&]
59 writerObserver->cancel();
60 anonymizerObserver->cancel();
61 readerObserver->cancel();
64 m_job->add(writerObserver);
65 m_job->add(anonymizerObserver, 10);
66 m_job->add(readerObserver);
68 const auto future =
m_job->run();
72 ::boost::filesystem::create_directories( destPath );
76 ::fwData::location::Folder::sptr loc = ::fwData::location::Folder::New();
77 loc->setFolder(destPath);
81 if(
m_job->cancelRequested())
89 if(
m_job->cancelRequested())
95 ::fwMedData::SeriesDB::sptr seriesDB = ::fwMedData::SeriesDB::New();
100 if(
m_job->cancelRequested())
109 ::fwMedData::DicomSeries::sptr anonymizedSeries =
110 ::fwMedData::DicomSeries::dynamicCast(seriesDB->getContainer().front());
111 destination->deepCopy(anonymizedSeries);
FWGDCMIO_API DicomSeriesAnonymizer()
Constructor.
::fwGdcmIO::helper::DicomSeriesWriter::sptr m_writer
Dicom writer.
FWGDCMIO_API std::shared_ptr< ::fwJobs::Aggregator > getJob() const
Get job observer.
The namespace fwGdcmIO contains reader, writer and helper for dicom data.
std::shared_ptr< ::fwJobs::Aggregator > sptr
Aggregator container type.
std::shared_ptr< ::fwJobs::Aggregator > m_job
Job observer.
virtual FWGDCMIO_API ~DicomSeriesAnonymizer()
Destructor.
::fwGdcmIO::helper::DicomAnonymizer m_anonymizer
Dicom anonymizer.
FWGDCMIO_API std::shared_ptr< ::fwJobs::IJob > getJob() const
Get job observer.
This namespace fwJobs provides jobs management.
FWGDCMIO_API void anonymize(const ::fwMedData::DicomSeries::sptr &source)
Anonymize the DicomSeries (modify the current object)
::fwGdcmIO::reader::SeriesDB::sptr m_reader
Dicom Reader.
FWGDCMIO_API void anonymize(const ::boost::filesystem::path &dirPath)
Anonymize a folder containing Dicom files.