MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
mlDicomSRSave.h
Go to the documentation of this file.
1// Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2// **InsertLicense** code
3//----------------------------------------------------------------------------------
5
39//----------------------------------------------------------------------------------
40#pragma once
41
42// Local includes
44
45// ML includes
46#include <mlModuleIncludes.h>
47#include <mlDicomSaveBase.h>
48
49// Tag/Field manager.
55
56#include <FMEThirdPartyWarningsDisable.h>
57#include "dcmtk/config/osconfig.h"
58#include "dcmtk/ofstd/ofstream.h"
59#include "dcmtk/dcmdata/dcfilefo.h"
60#include <FMEThirdPartyWarningsRestore.h>
61
62// DICOM tree etc.
63#include <DCMTree_Tree.h>
64
65// Forward(s).
66class DSRDocument;
67class OFCondition;
68
70
71//----------------------------------------------------------------------------------
72// See above.
73//----------------------------------------------------------------------------------
75{
76public:
77
80
82 static OFString toOFString(std::string str);
83
87 static void checkOFCondition(const OFCondition &cond, const std::string &loc);
88
89protected:
90
93
96
99 void activateAttachments() override;
100
103 std::string _checkConsistency() const override;
104
107
110
112 void _updateDumps(const std::string &fileName, std::string &statusStr);
113
115 void _save() override;
117
119
120 inline StringField &getLongXMLInfoField() const { return *_longXMLInfoFld ; }
121 inline const BoolField &getSaveAsDCMField() const { return *_saveAsDCMFld ; }
122 inline const BoolField &getSaveAsXMLField() const { return *_saveAsXMLFld ; }
123 inline StringField &getShortInfoField() const { return *_shortInfoFld ; }
125
126private:
127 // ----------------------------------------------------------
128 // General tool functions.
129 // ----------------------------------------------------------
130
132 void _addMainParameterFields();
133
135 void _addMainDICOMTagFields();
136
139 std::string _setUpTreeContent() override;
140
142 void _setUpContentParameters(DSRDocument &doc) const;
143
146 void _setBaseTagValues(DSRDocument &doc) const;
147
154 void _setUpContentTree(DSRDocument &doc,
155 const PagedImage *inImg,
156 DCMTree::Const_TreePtr dcmTree) const;
157
159 void _doFinalDocumentSettings(DSRDocument &doc) const;
160
161 // Module field declarations:
162
164 BoolField *_saveAsHTMLFld;
165
167 StringField *_longHTMLInfoFld;
168
170 BoolField *_saveAsDCMFld;
171
173 BoolField *_saveAsXMLFld;
174
176 StringField *_shortInfoFld;
177
179 StringField *_longXMLInfoFld;
180
182 EnumField *_documentTypeFld;
183
185 DicomPatientModuleTagInterface _patientModule;
186
188 DicomGeneralStudyModuleTagInterface _generalStudyModule;
189
191 DicomGeneralSeriesModuleTagInterface _generalSeriesModule;
192
194 DicomGeneralEquipmentModuleTagInterface _generalEquipmentModule;
195
197 DicomGeneralImageModuleTagInterface _generalImageModule;
198
201 BoolField *_completeDocumentFld;
203 StringField *_docCompletionDescriptionFld;
204
207 BoolField *_verifyDocumentFld;
209 StringField *_verifyDocumentObserverNameFld;
211 StringField *_verifyDocumentOrganizationFld;
212
215 BoolField *_finalizeDocumentFld;
216
218 BoolField *_preliminaryFlagFld;
219
221 StringField *_documentTitleFld;
222
224 StringField *_documentIntroTitleFld;
225
227 StringField *_documentIntroFld;
228
230 void _addTextSectionFields();
232 enum {
233 NumDocumentSections = 5
234 };
236 EnumField *_codingValueAndMeaningFld[NumDocumentSections];
238 StringField *_codeMeaningFld[NumDocumentSections];
240 BoolField *_openSubSectionFld[NumDocumentSections];
242 BoolField *_closeSubSectionFld[NumDocumentSections];
244 StringField *_subSectionContainerTitleFld[NumDocumentSections];
246 StringField *_subSectionTitleFld[NumDocumentSections];
248 StringField *_subSectionTextFld[NumDocumentSections];
250 StringField *_sectionTextFld[NumDocumentSections];
251
252 // Field input connections:
254 void _addInputConnectorFields();
255
257 enum {
258 NumInputConnectorFields = 10
259 };
260
262 StringField *_inputFld[NumInputConnectorFields];
263
266};
267
Project global and OS specific declarations.
#define MLDICOMOUTPUTS_EXPORT
DLL export macro definition.
Creates and composes a DICOM structured report and exports it to different file formats or fields....
Field to encapsulate a boolean value.
Definition mlFields.h:56
Manages the module field interface according to DICOM General Equipment, C.7.5.1.
Manages the module field interface according to DICOM General Image, C.7.6.1.
Manages the module field interface according to DICOM General Series, C.7.3.1.
Manages the module field interface according to DICOM General Study, C.7.1.3.
Manages the module field interface according to DICOM Patient Module, C.7.1.1.
std::string _checkConsistency() const override
Checks for invalid parameters which could cause problems in document creation and return textual desc...
void _save() override
Creates a structured report DICOM objects and saves it in the file given by _fileNameFld.
DicomSRSave()
Constructor.
static void checkOFCondition(const OFCondition &cond, const std::string &loc)
Check the passed condition cond for bad(), and if yes, then an ML error message is generated includin...
void _inheritFieldValuesFromDCMTree(DCMTree::Const_TreePtr dcmTree) override
Overloads base class field inheritance and adds the additional tags needed by this class.
void _updateDumps(const std::string &fileName, std::string &statusStr)
Update short and long XML dump fields from SR document fileName and append possible errors to statusS...
void activateAttachments() override
Updates the internal module state after loading or cloning the module, and enables notification handl...
StringField & getShortInfoField() const
StringField & getLongXMLInfoField() const
Field access, see corresponding field for details.
const BoolField & getSaveAsDCMField() const
const BoolField & getSaveAsXMLField() const
void handleNotification(Field *field) override
Handles field changes of the field field.
std::string _applyFieldAddOns(const OFString &absoluteFullFilePath)
Applies tags as specified by FieldAddOns to the file absoluteFullFilePath which is overwritten.
static OFString toOFString(std::string str)
Converts an std::string to an OFString and replaced tabs by four spaces.
virtual std::string _setUpTreeContent()=0
Allows the user to apply changes to the tree before it is saved; called after _updateInputState() and...
Field to encapsulate an enumerated value.
Definition mlFields.h:185
Base class for all fields used in the ML.
Definition mlField.h:73
The class PagedImage, representing a fragmented image that manages properties and data of an image lo...
Field to encapsulate a string value.
Definition mlFields.h:634
#define ML_MODULE_CLASS_HEADER(className)
Similar to ML_CLASS_HEADER for the usage of derived classes from Module.
Header file for the ML module base class DicomGeneralEquipmentModuleTagInterface.
Header file for the ML module base class DicomGeneralImageModuleTagInterface.
Header file for the ML module base class DicomGeneralSeriesModuleTagInterface.
Header file for the ML module base class DicomGeneralStudyModuleTagInterface.
Header file for the ML module base class DicomPatientModuleTagInterface.
Header file for the ML module base class DicomSaveBase.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
boost::shared_ptr< const Tree > Const_TreePtr
Definition DCMTree_Lib.h:68