MeVisLab Toolbox Reference
mlMultiFileVolumeListView.h
Go to the documentation of this file.
1// Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2// **InsertLicense** code
3//----------------------------------------------------------------------------------
5
10//----------------------------------------------------------------------------------
11#pragma once
12
13// Local includes
15
16// ML includes
17#include <mlModuleIncludes.h>
18
19// DCMTree stuff.
20#include <DCMTree_Tree.h>
21
23
24// Forwards to internally used classes.
25class MultiFileVolume;
26class MultiFileVolumeList;
27
28//----------------------------------------------------------------------------------
30//----------------------------------------------------------------------------------
32{
33public:
34
37 UseFirstSlice = 0,
39
40 NumIconBuildModes
41 };
42
44 static const char * const IconBuildModeStrings[NumIconBuildModes];
45
48
51
54
56 void checkSortParameters() const;
57
61 bool &updateThumbNails,
62 bool &updateTableSort,
64
68
71 const std::string &validCacheDir,
72 const std::string &validCacheFileName);
73
75 static std::string createThumbFileName(const std::string &cacheDir,
76 const std::string &cacheFileName,
77 const size_t volumeIndex);
78
83 static void removeThumbNail(const size_t volumeIndex,
84 const std::string& validCacheDir,
85 const std::string& validCacheFileName);
86
91 static void removeThumbNails(const size_t numVolumes,
92 const std::string& validCacheDir,
93 const std::string& validCacheFileName);
94
103 size_t subSetStart=0u,
104 size_t subSetEnd=std::string::npos);
105
109
111 static void replaceNonTableViewChars(const std::string& columnSubStr, std::string &correctedStr);
112
113protected:
114
118 std::string name;
119
121 std::string head;
122
124 std::string value;
125 };
126
128 typedef std::vector<std::vector<_ColumnNameHeadValue> > _ColumnNameHeadValueVector;
129
132
136 size_t idx,
137 bool useNumericTagValueSorting) const;
138
140 void _appendTableColumn(const size_t &volumeIdx,
142 size_t &descIdx,
143 bool isFirst,
144 const std::string &userVal,
145 bool isTagValue,
147
149 std::vector<size_t> _determineTableColumnOrder() const;
150
155 bool showDots,
156 std::string &tableString) const;
157
160
164
167
171
178
181
185
190
192 StringField *_userColumnTagFld[3];
193
196
200
203 public:
205 std::string fieldIdName;
206
209
211 std::string headInfo;
212
214 inline DirectDicomImportColumnDesc(const std::string &fldName, DCMTree::RawTagId id, const std::string&info):
215 fieldIdName(fldName),
216 rawTagId(id),
217 headInfo(info){}
218
221
224 if (this != &orig){
225 fieldIdName = orig.fieldIdName;
226 rawTagId = orig.rawTagId;
227 headInfo = orig.headInfo;
228 }
229 return *this;
230 }
231
232 private:
235 };
236
238 std::vector<DirectDicomImportColumnDesc> _columnDescs;
239};
240
Project global and OS specific declarations.
#define MLDIRECTDICOMIMPORTOUTPUTS_EXPORT
DLL export macro definition.
Field to encapsulate a boolean value.
Definition mlFields.h:58
Field to encapsulate an enumerated value.
Definition mlFields.h:195
Defines the class FieldContainer to encapsulate a vector of fields for (see class Field).
Base class for all fields used in the ML.
Definition mlField.h:73
Field to encapsulate an integer value.
Definition mlFields.h:126
DCMTree::RawTagId rawTagId
Raw Tag Id of tag to be shown, may be 0 for non DICOM tags.
DirectDicomImportColumnDesc(const std::string &fldName, DCMTree::RawTagId id, const std::string &info)
Convenience constructor.
DirectDicomImportColumnDesc(const DirectDicomImportColumnDesc &orig)
Copy constructor.
DirectDicomImportColumnDesc & operator=(const DirectDicomImportColumnDesc &orig)
Assignment operator.
std::string fieldIdName
String Id of the list view column, must be unique and non empty.
std::string headInfo
String to be shown in column head of ListView.
Manages the volume list view and its contents for the DirectDicomImport module.
static void removeThumbNails(const size_t numVolumes, const std::string &validCacheDir, const std::string &validCacheFileName)
Removes possibly existing thumbnails indexed from 0 to numVolumes-1 with cachefileName validCacheFile...
EnumField * _iconBuildModeFld
Selects the mode how and from which slices of the image the icons in the volume table are created,...
std::vector< std::vector< _ColumnNameHeadValue > > _ColumnNameHeadValueVector
Type used for managing and sorting all rows and columns of the ListView.
void _checkIdxSortTagValue() const
Logs an ML error if _idxSortTagValueFld has an invalid content.
void updateThumbNailFiles(MultiFileVolumeList &volumeList, const std::string &validCacheDir, const std::string &validCacheFileName)
Update the list of thumbnails from the source volumes and write them in the cache directory.
const BoolField & getUseThumbNailsField() const
Returns read access to the useThumbNails field; only allowed to be called after appendFields() call.
void updateVolumeListView(const MultiFileVolumeList &volumeList, size_t subSetStart=0u, size_t subSetEnd=std::string::npos)
Update the volume list with all columns.
BoolField * _useNumericTagValueSortingFld
If enabled then tags with value representations IS are interpreted as sign 32 bit integers and printe...
void handleNotification(Field &field, bool &updateVolumeListViewFlag, bool &updateThumbNails, bool &updateTableSort, bool isResultCachingPossible)
Handle field changes of the field field.
NotifyField * _updateThumbNailsFld
Field containing the path base to the pixMaps and to trigger an update of pixmaps on the volumeInfosF...
std::vector< DirectDicomImportColumnDesc > _columnDescs
Boolean fields to enable/disable tags.
StringField * _volumeListViewFld
The field containing the Volume table with columns.
std::string _getUserTagVal(DCMTree::Const_TreePtr tree, size_t idx, bool useNumericTagValueSorting) const
Returns the value of the tag specified in user tag id fields from tree or "" if not possible.
StringField * _columnConfigFld
Configuration string containing the list of column names to be displayed.
void updateSortOrderOfVolumeTable(MultiFileVolumeList &volumeList) const
Sorts the volumes according to the current sort mode.
IntField * _thumbNailsExtFld
Extent of thumbNails, default is 40.
void _buildTableString(const _ColumnNameHeadValueVector &tableColumns, bool showDots, std::string &tableString) const
Build the final table string from all row/column entries; if showDots is true then a final line with ...
static std::string createThumbFileName(const std::string &cacheDir, const std::string &cacheFileName, const size_t volumeIndex)
Create file name for thumbNailFile with index v in directory cacheDir and for cache file cacheFileNam...
MultiFileVolumeListView()
Constructor.
static void replaceNonTableViewChars(const std::string &columnSubStr, std::string &correctedStr)
Replaces all string components in columnSubStr which could disturb the list view such as newlines,...
void _appendTableColumn(const size_t &volumeIdx, DCMTree::Const_TreePtr tree, size_t &descIdx, bool isFirst, const std::string &userVal, bool isTagValue, _ColumnNameHeadValueVector &tableColumns) const
Updates head line and value for the volume view list.
virtual ~MultiFileVolumeListView()
Destructor.
BoolField * _useThumbNailsField
Field containing the pointer to the thumbnail enable/disable toggle.
static void removeThumbNail(const size_t volumeIndex, const std::string &validCacheDir, const std::string &validCacheFileName)
Removes possibly existing thumbnail with index volumeIndex with cachefileName validCacheFileName whic...
BoolField * _sortUpwardsFld
If enabled sorting orders the higher values to first, otherwise to last position.
StringField * _idxSortTagValueFld
Field specifying a DICOM tag whose value is used to sort the volume list; only used when_sortMode is ...
IconBuildMode
Modes how icons shall be generated.
@ UseMiddleSlice
Fist slice of image is used to build the icon.
void appendFields(FieldContainer &fieldContainer)
Creates all bool fields for volume vie columns. To be called in constructor.
EnumField * _sortModeFld
Enumerator field showing all sort modes for list of output volumes, default is MultiFileVolumeList::N...
void checkSortParameters() const
Perform some checks on sort parameters and logs errors if necessary.
std::vector< size_t > _determineTableColumnOrder() const
Parse the _columnConfigFld and determines the order of visible columns.
Class managing a list of MultiFileVolume instances for the DirectDicomImport module; taking ownership...
Field without value for notifications.
Definition mlFields.h:659
Field to encapsulate a string value.
Definition mlFields.h:610
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
boost::shared_ptr< const Tree > Const_TreePtr
Definition DCMTree_Lib.h:73
unsigned int RawTagId
Composition of a column name, the head entry, and the column value.
std::string head
Entry to be shown in the head line.
std::string name
Unique name of the column, take care it must exist only once.