MeVisLab Toolbox Reference
mlFileListFilterPlugin.h
Go to the documentation of this file.
1// Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2// **InsertLicense** code
3//----------------------------------------------------------------------------------
6
11//----------------------------------------------------------------------------------
12#pragma once
13
14// Local includes
16
17// Include muParse for the evaluation of numeric function strings.
18#if defined _WIN32
19//include as C-API only for windows case as the muParser API is written like that
20extern "C"
21{
22 #include "muParserDLL.h"
23}
24#else
25 #include "muParserDLL.h"
26#endif
27
28ML_START_NAMESPACE
29
30//----------------------------------------------------------------------------------
33//----------------------------------------------------------------------------------
35{
36public:
37
53
69
85
87 static const char * const LabellingEnumStrings[NumLabellingEnumModes];
88
91
94
96 FileListFilterPlugin(int numIns=0, int numOuts=0);
97
100
107 virtual void filterFile(FileListTools::FileAttribute &filterAttributes,
108 FilterMessageList *messageList) const override;
109
111 inline BoolField &getClearPassFlagBeforeFilteringFld () const { return *_clearPassFlagBeforeFilteringFld ; }
112 inline StringField &getVolumeLabelFld () const { return *_volumeLabelFld ; }
113 inline StringField &getVolumeConfigFld () const { return *_volumeConfigFld ; }
114 inline StringField &getProcessingSettingsFld () const { return *_processingSettingsFld ; }
115 inline EnumField &getLabelAssignModeFld () const { return *_labelAssignModeFld ; }
116 inline EnumField &getConfigAssignModeFld () const { return *_configAssignModeFld ; }
117 inline EnumField &getProcessingSettingsAssignModeFld () const { return *_processingSettingsAssignModeFld ; }
118 inline BoolField &getAllowRecursiveTagSearchFld () const { return *_allowRecursiveTagSearchFld ; }
119 inline BoolField &getApplyFilePathFilterFld () const { return *_applyFilePathFilterFld ; }
120 inline StringField &getPathFilterRegExFld () const { return *_pathFilterRegExFld ; }
121 inline BoolField &getInvertPathFilterRegExFld () const { return *_invertPathFilterRegExFld ; }
122 inline BoolField &getSetPassFlagOnPathMatchesFld () const { return *_setPassFlagOnPathMatchesFld ; }
123 inline BoolField &getClearPassFlagOnPathMismatchesFld () const { return *_clearPassFlagOnPathMismatchesFld ; }
124 inline StringField &getRegExStatusFld () const { return *_regExStatusFld ; }
125 inline BoolField &getApplyTagStringFilterFld () const { return *_applyTagStringFilterFld ; }
126 inline StringField &getTagStringFilterTagIdFld () const { return *_tagStringFilterTagIdFld ; }
127 inline IntField &getTagStringFilterTagValueIndexFld () const { return *_tagStringFilterTagValueIndexFld ; }
128 inline StringField &getTagStringFilterPrivateCreatorFld () const { return *_tagStringFilterPrivateCreatorFld ; }
129 inline BoolField &getCheckOnlyFirstRecursiveTagStringFld () const { return *_checkOnlyFirstRecursiveTagStringFld ; }
130 inline StringField &getTagStringEvalRegExFld () const { return *_tagStringEvalRegExFld ; }
131 inline BoolField &getInvertTagStringEvalRegExFld () const { return *_invertTagStringEvalRegExFld ; }
132 inline BoolField &getSetTagStrEvalPassFlagOnPathMatchesFld () const { return *_setTagStrEvalPassFlagOnPathMatchesFld ; }
133 inline BoolField &getClearTagStrEvalPassFlagOnPathMismatchesFld () const { return *_clearTagStrEvalPassFlagOnPathMismatchesFld; }
134 inline StringField &getTagFilterRegExStatusFld () const { return *_tagFilterRegExStatusFld ; }
135 inline BoolField &getApplyTagValueFilterFld () const { return *_applyTagValueFilterFld ; }
136 inline StringField &getTreeFilterExFld () const { return *_treeFilterExFld ; }
137 inline StringField &getTagId0Fld () const { return *_tagId0Fld ; }
138 inline StringField &getTagId1Fld () const { return *_tagId1Fld ; }
139 inline StringField &getTagId2Fld () const { return *_tagId2Fld ; }
140 inline StringField &getTagId3Fld () const { return *_tagId3Fld ; }
141 inline IntField &getTagId0ValueIndexFld () const { return *_tagId0ValueIndexFld ; }
142 inline IntField &getTagId1ValueIndexFld () const { return *_tagId1ValueIndexFld ; }
143 inline IntField &getTagId2ValueIndexFld () const { return *_tagId2ValueIndexFld ; }
144 inline IntField &getTagId3ValueIndexFld () const { return *_tagId3ValueIndexFld ; }
145 inline StringField &getTagId0PrivateCreatorFld () const { return *_tagId0PrivateCreatorFld ; }
146 inline StringField &getTagId1PrivateCreatorFld () const { return *_tagId1PrivateCreatorFld ; }
147 inline StringField &getTagId2PrivateCreatorFld () const { return *_tagId2PrivateCreatorFld ; }
148 inline StringField &getTagId3PrivateCreatorFld () const { return *_tagId3PrivateCreatorFld ; }
149 inline DoubleField &getConst0Fld () const { return *_const0Fld ; }
150 inline DoubleField &getConst1Fld () const { return *_const1Fld ; }
151 inline DoubleField &getConst2Fld () const { return *_const2Fld ; }
152 inline DoubleField &getConst3Fld () const { return *_const3Fld ; }
153 inline DoubleField &getRangeMinFld () const { return *_rangeMinFld ; }
154 inline DoubleField &getRangeMaxFld () const { return *_rangeMaxFld ; }
155 inline BoolField &getSetPassFlagOnTagValueMatchesFld () const { return *_setPassFlagOnTagValueMatchesFld ; }
156 inline BoolField &getClearPassFlagOnTagValueMismatchesFld () const { return *_clearPassFlagOnTagValueMismatchesFld ; }
157 inline StringField &getTreeFilterStatusFld () const { return *_treeFilterStatusFld ; }
158 inline BoolField &getAlwaysPassEnhancedMultiFrameFilesFld () const { return *_alwaysPassEnhancedMultiFrameFilesFld ; }
159 inline BoolField &getFilterDecomposedEnhancedFramesFld () const { return *_filterDecomposedEnhancedFramesFld ; }
161
162protected:
163
165 void activateAttachments() override;
166
169 void handleNotification(Field *field) override;
170
174
181 FilterMessageList *messageList,
182 bool &wasDisabled,
183 bool &wasEnabled,
184 bool &expMatches) const;
185
189
198 FilterMessageList *messageList,
199 bool &wasDisabled,
200 bool &wasEnabled,
201 bool &expMatches,
202 DCMTree::Const_TreePtr &dcmTree) const;
203
212 void _updateFlagsAccordingToTagStringValues(const std::vector<std::string>& tagStringValues,
213 bool& passFlag,
214 bool& wasDisabled,
215 bool& wasEnabled,
216 bool& expMatches) const;
217
221
230 FilterMessageList *messageList,
231 bool &wasDisabled,
232 bool &wasEnabled,
233 bool &expMatches,
234 DCMTree::Const_TreePtr dcmTree) const;
235
242 virtual void _applyLabelling(FileListTools::FileAttribute &filterAttributes,
243 FilterMessageList *messageList,
244 bool &wasDisabled,
245 bool &wasEnabled,
246 bool &expMatches) const;
247
255 FilterMessageList *messageList,
256 bool &wasDisabled,
257 bool &wasEnabled,
258 bool &expMatches) const;
259
267 FilterMessageList *messageList,
268 bool &wasDisabled,
269 bool &wasEnabled,
270 bool &expMatches) const;
271
279 DCMTree::RawTagId rawTagId,
280 std::vector<DCMTree::Const_TagPtr>* foundTags) const;
281
306 DCMTree::RawTagId rawTagId,
307 const std::string &privateCreatorStr,
308 std::vector<DCMTree::Const_TagPtr> *foundTags=nullptr) const;
309
313 std::vector<std::string> &foundValues) const;
314
315
330 MLint tagValueFilterId,
331 const std::string &privateCreatorString,
332 MLint valueIndex) const;
333
334private:
335
336 //----------- General settings:
338 BoolField *_clearPassFlagBeforeFilteringFld;
339
341 StringField *_volumeLabelFld;
342
344 StringField *_volumeConfigFld;
345
347 StringField *_processingSettingsFld;
348
350 EnumField *_labelAssignModeFld;
351
353 EnumField *_configAssignModeFld;
354
356 EnumField *_processingSettingsAssignModeFld;
357
359 BoolField *_allowRecursiveTagSearchFld;
360
361 //----------- Path filtering:
363 BoolField *_applyFilePathFilterFld;
364
366 StringField *_pathFilterRegExFld;
367
369 BoolField *_invertPathFilterRegExFld;
370
372 BoolField *_setPassFlagOnPathMatchesFld;
373
375 BoolField *_clearPassFlagOnPathMismatchesFld;
376
378 StringField *_regExStatusFld;
379
380
381 //----------- String tag filtering:
383 BoolField *_applyTagStringFilterFld;
384
386 StringField *_tagStringFilterTagIdFld;
387
390 IntField *_tagStringFilterTagValueIndexFld;
391
393 StringField *_tagStringFilterPrivateCreatorFld;
394
397 BoolField *_checkOnlyFirstRecursiveTagStringFld;
398
400 StringField *_tagStringEvalRegExFld;
401
403 BoolField *_invertTagStringEvalRegExFld;
404
406 BoolField *_setTagStrEvalPassFlagOnPathMatchesFld;
407
409 BoolField *_clearTagStrEvalPassFlagOnPathMismatchesFld;
410
412 StringField *_tagFilterRegExStatusFld;
413
415 MLint _strEvalTagId;
416
417
418 //----------- Numeric Tag filtering:
420 muParserHandle_t _parser;
421
423 BoolField *_applyTagValueFilterFld;
424
426 StringField *_treeFilterExFld;
427
429 StringField *_tagId0Fld;
430 StringField *_tagId1Fld;
431 StringField *_tagId2Fld;
432 StringField *_tagId3Fld;
434
436 IntField *_tagId0ValueIndexFld;
437 IntField *_tagId1ValueIndexFld;
438 IntField *_tagId2ValueIndexFld;
439 IntField *_tagId3ValueIndexFld;
441
443 StringField *_tagId0PrivateCreatorFld;
444 StringField *_tagId1PrivateCreatorFld;
445 StringField *_tagId2PrivateCreatorFld;
446 StringField *_tagId3PrivateCreatorFld;
448
450 MLint _tagValueFilterId0;
451 MLint _tagValueFilterId1;
452 MLint _tagValueFilterId2;
453 MLint _tagValueFilterId3;
455
457 DoubleField *_const0Fld;
458 DoubleField *_const1Fld;
459 DoubleField *_const2Fld;
460 DoubleField *_const3Fld;
462
464 DoubleField *_rangeMinFld;
465 DoubleField *_rangeMaxFld;
467
469 BoolField *_setPassFlagOnTagValueMatchesFld;
470
472 BoolField *_clearPassFlagOnTagValueMismatchesFld;
473
474
476 StringField *_treeFilterStatusFld;
477
479 BoolField *_alwaysPassEnhancedMultiFrameFilesFld=nullptr;
480
482 BoolField *_filterDecomposedEnhancedFramesFld=nullptr;
483
486};
487
490
491
492ML_END_NAMESPACE
#define MLFILE_LIST_TOOLS_EXPORT
DLL export macro definition.
FileListFilterPluginBase(int numIns=0, int numOuts=0)
Constructor. Input and out images are probably not used.
ProcessingSettingsAssignmentEnumModes
Enumerator defining how processing settings are assigned to the file attribute structures.
@ SetProcSettingsIfPassFlagIsTrue
The processing settings are assigned if after filtering the pass flag is true or if it was already tr...
@ NumProcSettingsAssignmentEnumModes
Number of available modes, not to be used as mode.
@ SetProcSettingsIfExpressionDoesNotMatch
The processing settings are assigned if any expression does not match.
@ SetProcSettingsIfPassFlagIsFalse
The processing settings are assigned if after filtering the pass flag is false or if it was false bef...
@ SetProcSettingsIfExpressionMatches
The processing settings are assigned if any expression matches.
@ SetProcSettingsIfPassFlagIsSet
The processing settings are assigned if the pass flag is set to true (independent of its previous sta...
@ UnsetProcSettingsIfExpressionMatches
The processing settings are reset if any expression matches.
@ SetProcSettingsIfPassFlagIsUnchanged
The processing settings are assigned if the pass flag is neither set nor cleared by the filter.
@ SetProcSettingsIfPassFlagIsCleared
The processing settings are assigned if the pass flag is set to false (independent of its previous st...
@ DoNotChangeProcSettings
Processing settings of attributes is not changed at all.
@ UnsetProcSettingsIfExpressionDoesNotMatch
The processing settings are reset if any expression does not match.
virtual bool _handleNotificationForPathStringFiltering(Field *field)
StringField & getRegExStatusFld() const
virtual void filterFile(FileListTools::FileAttribute &filterAttributes, FilterMessageList *messageList) const override
ConfigurationAssignmentEnumModes
Enumerator defining how configurations are assigned to the file/DCMTree attribute structures.
@ SetConfigIfExpressionDoesNotMatch
The configuration is assigned if any expression does not match.
@ SetConfigIfPassFlagIsUnchanged
The configuration is assigned if the pass flag is neither set nor cleared by the filter.
@ UnsetConfigIfExpressionDoesNotMatch
The configuration is assigned if any expression does not match.
@ SetConfigIfPassFlagIsFalse
The configuration is assigned if after filtering the pass flag is false or if it was false before.
@ SetConfigIfPassFlagIsCleared
The configuration is assigned if the pass flag is set to false (independent of its previous state).
@ NumConfigurationAssignmentEnumModes
Number of available modes, not to be used as mode.
@ UnsetConfigIfExpressionMatches
The configuration is assigned if any expression matches.
@ DoNotChangeConfig
Configuration selection of attributes is not changed at all.
@ SetConfigIfExpressionMatches
The configuration is assigned if any expression matches.
@ SetConfigIfPassFlagIsSet
The configuration is assigned if the pass flag is set to true (independent of its previous state).
@ SetConfigIfPassFlagIsTrue
The configuration is assigned if after filtering the pass flag is true or if it was already true befo...
EnumField & getLabelAssignModeFld() const
BoolField & getInvertPathFilterRegExFld() const
IntField & getTagId2ValueIndexFld() const
StringField & getProcessingSettingsFld() const
virtual void _applyFilePathFiltering(FileListTools::FileAttribute &filterAttributes, FilterMessageList *messageList, bool &wasDisabled, bool &wasEnabled, bool &expMatches) const
StringField & getVolumeLabelFld() const
StringField & getTagId2PrivateCreatorFld() const
StringField & getTagId0Fld() const
virtual void _applyTagStringFiltering(FileListTools::FileAttribute &filterAttributes, FilterMessageList *messageList, bool &wasDisabled, bool &wasEnabled, bool &expMatches, DCMTree::Const_TreePtr &dcmTree) const
StringField & getTagId1Fld() const
BoolField & getAlwaysPassEnhancedMultiFrameFilesFld() const
IntField & getTagStringFilterTagValueIndexFld() const
StringField & getTagId1PrivateCreatorFld() const
StringField & getVolumeConfigFld() const
IntField & getTagId1ValueIndexFld() const
BoolField & getSetPassFlagOnPathMatchesFld() const
void handleNotification(Field *field) override
StringField & getTagStringFilterPrivateCreatorFld() const
double _getTagValueForTagValueFilter(DCMTree::Const_TreePtr dcmTree, MLint tagValueFilterId, const std::string &privateCreatorString, MLint valueIndex) const
StringField & getTreeFilterStatusFld() const
void _updateFlagsAccordingToTagStringValues(const std::vector< std::string > &tagStringValues, bool &passFlag, bool &wasDisabled, bool &wasEnabled, bool &expMatches) const
StringField & getTagId2Fld() const
BoolField & getApplyFilePathFilterFld() const
BoolField & getClearPassFlagOnTagValueMismatchesFld() const
StringField & getTagId3Fld() const
BoolField & getClearPassFlagBeforeFilteringFld() const
Provide programming access to field interface, see corresponding member for documentation.
BoolField & getCheckOnlyFirstRecursiveTagStringFld() const
BoolField & getApplyTagValueFilterFld() const
static const char *const ProcessingSettingsAssignmentEnumStrings[NumProcSettingsAssignmentEnumModes]
Strings according to ProcessingSettingsAssignmentEnumModes.
virtual void _applyTagValueFiltering(FileListTools::FileAttribute &filterAttributes, FilterMessageList *messageList, bool &wasDisabled, bool &wasEnabled, bool &expMatches, DCMTree::Const_TreePtr dcmTree) const
virtual bool _handleNotificationForTagStringFiltering(Field *field)
IntField & getTagId0ValueIndexFld() const
BoolField & getSetTagStrEvalPassFlagOnPathMatchesFld() const
DoubleField & getConst2Fld() const
static const char *const LabellingEnumStrings[NumLabellingEnumModes]
Strings according to LabellingEnumModes.
BoolField & getAllowRecursiveTagSearchFld() const
StringField & getTagFilterRegExStatusFld() const
StringField & getTagId3PrivateCreatorFld() const
FileListFilterPlugin(int numIns=0, int numOuts=0)
Constructor. Input and out images are probably not used.
BoolField & getClearTagStrEvalPassFlagOnPathMismatchesFld() const
BoolField & getInvertTagStringEvalRegExFld() const
IntField & getTagId3ValueIndexFld() const
StringField & getTagStringFilterTagIdFld() const
StringField & getPathFilterRegExFld() const
BoolField & getClearPassFlagOnPathMismatchesFld() const
LabellingEnumModes
Enumerator defining how label values are assigned to the file/DCMTree attribute structures.
@ SetLabelIfExpressionDoesNotMatch
The label is assigned if any expression does not match.
@ SetLabelIfExpressionMatches
The label is assigned if any expression matches.
@ UnsetLabelIfExpressionMatches
The label is assigned if any expression matches.
@ SetLabelIfPassFlagIsTrue
The label is assigned if after filtering the pass flag is true or if it was already true before.
@ UnsetLabelIfExpressionDoesNotMatch
The label is assigned if any expression does not match.
@ SetLabelIfPassFlagIsFalse
The label is assigned if after filtering the pass flag is false or if it was false before.
@ DoNotChangeLabel
Label of attributes are not changed at all.
@ SetLabelIfPassFlagIsSet
The label is assigned if the pass flag is set to true (independent of its previous state).
@ SetLabelIfPassFlagIsCleared
The label is assigned if the pass flag is set to false (independent of its previous state).
@ NumLabellingEnumModes
Number of available modes, not to be used as mode.
@ SetLabelIfPassFlagIsUnchanged
The label is assigned if the pass flag is neither set nor cleared by the filter.
virtual bool _handleNotificationForTagValueFiltering(Field *field)
StringField & getTagStringEvalRegExFld() const
EnumField & getConfigAssignModeFld() const
static const char *const ConfigurationAssignmentEnumStrings[NumConfigurationAssignmentEnumModes]
Strings according to ConfigurationAssignmentEnumModes.
StringField & getTagId0PrivateCreatorFld() const
virtual void _applyProcessingSettingsAssignment(FileListTools::FileAttribute &filterAttributes, FilterMessageList *messageList, bool &wasDisabled, bool &wasEnabled, bool &expMatches) const
DoubleField & getRangeMaxFld() const
virtual void _applyConfigAssignment(FileListTools::FileAttribute &filterAttributes, FilterMessageList *messageList, bool &wasDisabled, bool &wasEnabled, bool &expMatches) const
~FileListFilterPlugin() override
Destructor.
DoubleField & getRangeMinFld() const
BoolField & getFilterDecomposedEnhancedFramesFld() const
BoolField & getApplyTagStringFilterFld() const
void _getTagStringValues(DCMTree::Const_TreePtr dcmTree, std::vector< std::string > &foundValues) const
DCMTree::Const_TagPtr _getNormalOrPrivateTag(DCMTree::Const_TreePtr dcmTree, DCMTree::RawTagId rawTagId, const std::string &privateCreatorStr, std::vector< DCMTree::Const_TagPtr > *foundTags=nullptr) const
StringField & getTreeFilterExFld() const
DoubleField & getConst0Fld() const
DoubleField & getConst3Fld() const
virtual void _applyLabelling(FileListTools::FileAttribute &filterAttributes, FilterMessageList *messageList, bool &wasDisabled, bool &wasEnabled, bool &expMatches) const
void activateAttachments() override
Update internal state after field reload or clone..
DoubleField & getConst1Fld() const
EnumField & getProcessingSettingsAssignModeFld() const
BoolField & getSetPassFlagOnTagValueMatchesFld() const
DCMTree::Const_TagPtr _searchOneOrMultipleTags(DCMTree::Const_TreePtr dcmTree, DCMTree::RawTagId rawTagId, std::vector< DCMTree::Const_TagPtr > *foundTags) const
#define ML_MODULE_CLASS_HEADER(className)
A base class for plugins which can be used by file list importers to filter and classify files.
MLint64 MLint
Definition mlTypeDefs.h:489
boost::shared_ptr< const Tag > Const_TagPtr
Definition DCMTree_Lib.h:57
boost::shared_ptr< const Tree > Const_TreePtr
Definition DCMTree_Lib.h:67
unsigned int RawTagId
FileListFilterPlugin DirectDicomImportImportFilterPlugin
For backward compatibility:
std::list< FilterMessage > FilterMessageList
List of messages which can occur during filter calls.