fw4spl
DicomSeriesWriter.hpp
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 #pragma once
8 
9 #include "fwGdcmIO/config.hpp"
10 
11 #include <fwData/location/Folder.hpp>
12 
13 #include <fwDataIO/writer/GenericObjectWriter.hpp>
14 
15 #include <string>
16 
17 namespace fwJobs
18 {
19 class Observer;
20 class IJob;
21 }
22 
23 namespace fwMedData
24 {
25 class DicomSeries;
26 }
27 
28 namespace fwZip
29 {
30 class IWriteArchive;
31 }
32 
33 namespace fwGdcmIO
34 {
35 
36 namespace helper
37 {
38 class DicomAnonymizer;
39 
49 class DicomSeriesWriter : public ::fwDataIO::writer::GenericObjectWriter< ::fwMedData::DicomSeries >,
50  public ::fwData::location::enableFolder< ::fwDataIO::writer::IObjectWriter >
51 {
52 
53 public:
54 
57  (()), ::fwDataIO::writer::factory::New< DicomSeriesWriter >);
59 
62 
64  FWGDCMIO_API void write() override;
65 
67  FWGDCMIO_API std::string extension() override;
68 
70  FWGDCMIO_API SPTR(::fwJobs::IJob) getJob() const override;
71 
73  FWGDCMIO_API void setAnonymizer(const SPTR(helper::DicomAnonymizer)& anonymizer);
74 
81  FWGDCMIO_API void setOutputArchive(const SPTR(::fwZip::IWriteArchive)& archive,
82  const std::string& subPath = "");
83 
84 protected:
85 
87  std::string getFilename(const size_t& instanceIndex);
88 
90  void processStream(std::istream& inputStream, std::ostream& outputStream);
91 
93  void processWriteArchive();
94 
96  void processWrite();
97 
99  int m_writeCount;
100 
102  SPTR(::fwJobs::Observer) m_job;
103 
105  SPTR(DicomAnonymizer) m_anonymizer;
106 
108  SPTR(::fwZip::IWriteArchive) m_archive;
109 
111  std::string m_subPath;
112 };
113 
114 } // namespace helper
115 } // namespace fwGdcmIO
#define SPTR(_cls_)
Write a DicomSeries in DICOM format.
This class is an interface for class managing job.
Definition: IJob.hpp:28
Namespace containing medical data.
STL namespace.
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
The namespace fwGdcmIO contains reader, writer and helper for dicom data.
This class contains helpers to anonymize dicom files on filesystem. Anonymization is performed accord...
#define fwCoreClassDefinitionsWithFactoryMacro(_classinfo_, _parameters_, _factory_)
Generate common construction methods for classes with one factory.
#define fwCoreAllowSharedFromThis()
Generate getSptr and getConstSptr methods.
This class is derived by reader/writer.
Definition: Folder.hpp:80
The namespace fwZip provides IO for compress/uncompress .zip files using zlib .
Definition: Read.hpp:14
This namespace fwJobs provides jobs management.
generic class for all object writers.