Class managing a list of MultiFileVolume instances for the DirectDicomImport module; taking ownership of all added, push_back-ed or inserted MultiFileVolume instances.
More...
#include <mlMultiFileVolumeList.h>
|
| MultiFileVolumeList () |
|
virtual | ~MultiFileVolumeList () |
| Destructor.
|
|
| MultiFileVolumeList (const MultiFileVolumeList &ref) |
| Copy constructor.
|
|
MultiFileVolumeList & | operator= (const MultiFileVolumeList &ref) |
| Assignment operator *creating copied duplicates from ref).
|
|
void | setUpIssues (const DicomMessageCollector *dcmMsgCollector=nullptr) |
| Sets up the 'issues' members of all volumes; see MultiFileVolume::setUpIssues() for details.
|
|
std::string | getIssues (const DicomMessageCollector *dcmMsgCollector=nullptr) const |
| Returns a collected string with all issues; requires that issues have been set up before.
|
|
void | freeAllVolumes () |
| Deletes all volumes and reduce vector size to 0.
|
|
bool | equals (const MultiFileVolumeList &obj) const |
| Returns true if basic properties of *this and obj are identical, otherwise false.
|
|
void | sortVolumes (MultiFileVolumeListSort::SortModes sortMode, bool sortUpwards, MLint rawTagId, bool useNumericTagStringValueSorting) |
| Sorts the volume list according the given sort criteria sortMode; see MultiFileVolumeListSort for details.
|
|
MultiFileVolume * | findVolumeByInstanceUID (std::string sopClassUID, std::string sopInstanceUID) const |
| Find a volume in *this using given SOPClassUID and SOPInstanceUID; see MultiFileVolumeListFind for details.
|
|
bool | findVolumesByCriteria (TSearchTerm searchTerm, std::vector< MLuint32 > &outVolumeIds, MultiFileVolumeListFind::BooleanOperation booleanOperation, bool searchAnyValue) const |
| Find volumes in *this using given searchTerm (containing e.g.
|
|
MLErrorCode | appendToCache (const std::string &cacheDirPath, std::string &currCacheState, bool useRelativePaths, const std::string &optionalFilePrefix="") const |
| Converts the current state of this to a string.
|
|
MLErrorCode | setFromString (const std::string &state, const std::string &cacheDirPath, ProgressCB progressCB=nullptr, void *userData=nullptr, const float startPercentage=0.0f, const float percentageRange=1.0f, std::list< std::string > *cacheFileList=nullptr, DicomMessageCollector *dcmMsgCollector=nullptr) |
| Reads the state of this from the string state; returns ML_RESULT_OK on successful load and false on failure.
|
|
bool | searchFrameWithSOPInstanceUID (const std::string &sopInstanceUID, DICOMCachedIOFileHandle &foundHandle, DICOMTagTools::ZTUIndex &ztuPosition, MultiFileVolumeList::const_iterator &volumeIt, bool forceSearchInEnhancedHandles, bool alsoSearchInSMFTrees, DicomMessageCollector &dcmMsgCollector) const |
| Returns position and file handle of the first frame in the first volume with the given SOPInstanceUID.
|
|
bool | searchFrameWithValueInTag (unsigned int tagId, const std::string &tagValue, DICOMCachedIOFileHandle &foundHandle, DICOMTagTools::ZTUIndex &ztuPosition, MultiFileVolumeList::const_iterator &volumeIt, bool forceSearchInEnhancedHandles, bool alsoSearchInSMFTrees, DicomMessageCollector &dcmMsgCollector) const |
| Returns file handle and position of the first frame in the first volume with tagValue in a tag with id tagId.
|
|
std::vector< MultiFileVolumeList::const_iterator > | searchVolumesWithFramesWithValueInTag (unsigned int tagId, const std::string &tagValue, bool forceSearchInEnhancedHandles, bool alsoSearchInSMFTrees, DicomMessageCollector &dcmMsgCollector) const |
| Returns a vector of iterators to volumes which contain a frame with a tag with id tagId with value tagValue.
|
|
std::set< size_t > | searchVolumeIndexesWithValueInTag (unsigned int tagId, const std::string &tagValue, bool forceSearchInEnhancedHandles, bool alsoSearchInSMFTrees, DicomMessageCollector &dcmMsgCollector) const |
| Returns a set of indexes to volumes which contain a frame with a tag with id tagId with value tagValue.
|
|
|
MLErrorCode | loadResultCache (const std::string &fileNameInput, const std::string &cachePathInput, ProgressLogger *progressLogger, bool &volumeListChanged, ProgressCB progressCallback, void *userData) |
| Reload all information from the cache file in the cache file directory into the internal volume list and updates all related fields etc.
|
|
MLErrorCode | writeResultCache (const std::string &fileNameInput, const std::string &cachePathInput, const bool useRelativePaths, const bool writeSingleVolumeCaches, ProgressLogger *progressLogger) const |
| Writes all information into the cache file in the cache file directory.
|
|
MLErrorCode | loadResultCacheIntoVolumeList (const std::string &sourceFileName, const std::string &cacheDirPath, bool *volumeListChanged=nullptr, ProgressCB progressCB=nullptr, void *userData=nullptr, const float startPercentage=0.0f, const float percentageRange=1.0f, std::list< std::string > *cacheFileList=nullptr, DicomMessageCollector *dcmMsgCollector=nullptr) |
| Reload all information from the cache file in the cache file directory into *this.
|
|
MLErrorCode | loadMultiFileVolumeListCache (const std::string &fileName, bool *volumeListChanged=nullptr, ProgressCB progressCB=nullptr, void *userData=nullptr, const float startPercentage=0.0f, const float percentageRange=1.0f, std::list< std::string > *cacheFileList=nullptr) |
| Alternative load routine for a MultiFileVolume(List) from a cache file which first splits fileName to sourceFileName and cacheDirPath and then calls loadResultCacheIntoVolumeList; see its documentation for all other parameters.
|
|
MLErrorCode | clearResultFiles (ProgressLogger *progressLogger=nullptr) const |
| Clear all stored SMF-Tree files for the MultiFileVolumeList instance; cache files are not removed.
|
|
static std::string | getResultCacheFileName (const std::string &fileNameInput, const std::string &cachePathInput, std::string &fileName, std::string &cacheDirPath, const MLint fileIndex=-1) |
| Returns the full name path of the result cache file.
|
|
static MLErrorCode | clearResultCacheFiles (const std::string &fileNameInput, const std::string &cachePathInput, ProgressLogger *progressLogger=nullptr, RemoveUserFileCB userFileDeleter=nullptr) |
| Clear all files from the cache containing result volume files in the cache file directory.
|
|
Class managing a list of MultiFileVolume instances for the DirectDicomImport module; taking ownership of all added, push_back-ed or inserted MultiFileVolume instances.
Definition at line 47 of file mlMultiFileVolumeList.h.
◆ ProgressCB
◆ RemoveUserFileCB
A function callback which removes a user added cache file related to a volume which is stored in the cache director validCacheDir and is related to the cache file validCacheFileName.
Should be silent if the file does not exist.
Definition at line 59 of file mlMultiFileVolumeList.h.
◆ MultiFileVolumeList() [1/2]
ml::MultiFileVolumeList::MultiFileVolumeList |
( |
| ) |
|
◆ ~MultiFileVolumeList()
virtual ml::MultiFileVolumeList::~MultiFileVolumeList |
( |
| ) |
|
|
virtual |
◆ MultiFileVolumeList() [2/2]
◆ _setFromMultiCacheFile()
Helper function for setFromString: Reads the state of this from the string state; returns ML_RESULT_OK on successful load and false on failure.
On other return codes the state of this remains undefined. The content of the string state is reduced by the loaded volumes.
- Parameters
-
state | The string from which the data is read starting at readPos. |
cacheDirPath | The directory path where the cache file is located which contains state. |
progressCB | An optional static function pointer which is then called by this function to notify the progress while this function is executed (as described in percentageRange). |
userData | a pointer with user data passed to progressCB. It for example can be used to pass the calling instance object which is updated. |
startPercentage | is the percentage value of a progress bar which is updated when this function starts (for example to 0.3). |
percentageRange | is the range incrementally stepped through while this method is executed, for example 0.5. The progress then is increased incrementally from percentageStart to percentageStart+percentageRange, thus from 0.3 to 0.8 by a number of steps whose number is determined inside of the function. |
cacheFileList | If passed nullptr then it is ignored, otherwise it will be filled with the names of all cache files belonging to this stored cache.
|
readPos | The position in state where reading shall start from; will be incremented to the position after data set during read. |
dcmMsgCollector | If passed non-nullptr then it collects error, info and issue messages (typically related to a handle). |
- Returns
- ML_RESULT_OK in case of success or another error code in case of failure. In case of failure state is left with undefined content.
◆ appendToCache()
MLErrorCode ml::MultiFileVolumeList::appendToCache |
( |
const std::string & | cacheDirPath, |
|
|
std::string & | currCacheState, |
|
|
bool | useRelativePaths, |
|
|
const std::string & | optionalFilePrefix = "" ) const |
Converts the current state of this to a string.
- Parameters
-
cacheDirPath | Directory location where the cache file shall be stored. |
currCacheState | The returned string containing the composed string list of cache strings of volumes. |
useRelativePaths | If false (the default) then all file names in the cache string are stored with absolute paths. If true and if all referenced and stored files are located in cacheDirPath then all files are stored relative to cacheDirPath. Files which are not in that path are stored with absolute paths. |
optionalFilePrefix | A prefix which is added before files which are created as sub files of the cache state, for example SMF trees which are stored on disk for caching will have this prefix. |
- Returns
- ML_RESULT_OK in case of success or an error code describing the nature of the error.
◆ clearResultCacheFiles()
Clear all files from the cache containing result volume files in the cache file directory.
- Parameters
-
fileNameInput | the file name as it comes from the module input field. |
cachePathInput | the cache path as it comes from the module input field. |
progressLogger | If non nullptr then message are sent to this logger, otherwise it is ignored and messages are not logged. |
userFileDeleter | can be passed to be called for each volume of the result cache; it can delete files created for each volume and which have been placed next to the cache file. |
- Returns
- ML_RESULT_OK on success of if there was nothing to clean up or another error code describing the problem.
◆ clearResultFiles()
Clear all stored SMF-Tree files for the MultiFileVolumeList instance; cache files are not removed.
- Parameters
-
progressLogger | If non nullptr then message are sent to this logger, otherwise it is ignored and messages are not logged. |
- Returns
- ML_RESULT_OK on success of if there was nothing to clean up or another error code describing the problem.
◆ equals()
Returns true if basic properties of *this and obj are identical, otherwise false.
◆ findVolumeByInstanceUID()
MultiFileVolume * ml::MultiFileVolumeList::findVolumeByInstanceUID |
( |
std::string | sopClassUID, |
|
|
std::string | sopInstanceUID ) const |
◆ findVolumesByCriteria()
Find volumes in *this using given searchTerm (containing e.g.
DICOM tag ids of uint32 type); see MultiFileVolumeListFind for details.
◆ freeAllVolumes()
void ml::MultiFileVolumeList::freeAllVolumes |
( |
| ) |
|
Deletes all volumes and reduce vector size to 0.
◆ getIssues()
Returns a collected string with all issues; requires that issues have been set up before.
◆ getResultCacheFileName()
static std::string ml::MultiFileVolumeList::getResultCacheFileName |
( |
const std::string & | fileNameInput, |
|
|
const std::string & | cachePathInput, |
|
|
std::string & | fileName, |
|
|
std::string & | cacheDirPath, |
|
|
const MLint | fileIndex = -1 ) |
|
static |
Returns the full name path of the result cache file.
- Parameters
-
fileNameInput | the file name as it comes from the module input field. |
cachePathInput | the cache path as it comes from the module input field. |
fileName | will return the fileName with suffix without path components. |
cacheDirPath | will return the directory path including "/" at its end without file name. |
fileIndex | If < 0 (the default) then it is ignored, otherwise it will be added to the file name as an index. |
- Returns
- The absolute path composed of cache directory path, the file name and the suffix.
◆ loadMultiFileVolumeListCache()
Alternative load routine for a MultiFileVolume(List) from a cache file which first splits fileName to sourceFileName and cacheDirPath and then calls loadResultCacheIntoVolumeList; see its documentation for all other parameters.
◆ loadResultCache()
Reload all information from the cache file in the cache file directory into the internal volume list and updates all related fields etc.
If no changes occur on the volume list then volumeListChanged is set to false, otherwise it is set to true. On errors the internal list is completely cleared.
- Parameters
-
fileNameInput | the file name as it comes from the module input field. |
cachePathInput | the cache path as it comes from the module input field. |
progressLogger | If non nullptr then message are sent to this logger, otherwise it is ignored and messages are not logged. |
volumeListChanged | returns false if the volume list was not changed by the call, otherwise true. |
progressCallback | An optional static function pointer which is then called by this function to notify the progress while this function is executed. |
userData | The user data object passed from caller passing hidden contents. |
- Returns
- ML_RESULT_OK on success, otherwise an error code describing the problem.
◆ loadResultCacheIntoVolumeList()
Reload all information from the cache file in the cache file directory into *this.
Return ML_RESULT_OK on success, otherwise an error code describing the problem. On errors the list is returned as far as possible to allow file clean up operations, even if it might not be complete. Non existing cache file are considered as error.
- Parameters
-
sourceFileName | The name of the cache file without path. |
cacheDirPath | The directory in which the sourceFile is located. |
volumeListChanged | If passed non nullptr then *volumeListChanged is set to true on any change or reload of volumeList, otherwise false. For example it returns false on return code ML_RESULT_OK, if the cache file is considered unchanged. |
progressCB | An optional static function pointer which is then called by this function to notify the progress while this function is executed (as described in percentageRange). |
userData | a pointer with user data passed to progressCB. It for example can be used to pass the calling instance object which is updated. |
startPercentage | is the percentage value of a progress bar which is updated when this function starts (for example to 0.3). |
percentageRange | is the range incrementally stepped through while this method is executed, for example 0.5. The progress then is increased incrementally from percentageStart to percentageStart+percentageRange, thus from 0.3 to 0.8 by a number of steps whose number is determined inside of the function. |
cacheFileList | If passed nullptr then it is ignored, otherwise it will be filled with the names of all cache files belonging to this stored cache (but no image or DICOM tree files).
|
dcmMsgCollector | If passed non-nullptr then it collects error, info and issue messages (typically related to a handle). |
- Returns
- ML_RESULT_OK if *previousCacheContent and loaded cache file are identical and volumeList is left unchanged or in the case of successfully loaded and parsed sourceFile. In all other cases an MLErrorCode describing the nature of the error.
◆ operator=()
Assignment operator *creating copied duplicates from ref).
◆ searchFrameWithSOPInstanceUID()
Returns position and file handle of the first frame in the first volume with the given SOPInstanceUID.
- Parameters
-
sopInstanceUID | Input parameter: The SOPInstanceUID to be searched in the frames. |
foundHandle | Output parameter: The file handle of the frame with the given SOPInstanceUID; will be empty if not found. |
ztuPosition | Output parameter: Will be set with z, t, and u indexes of the frame in the FileNameSet which has the given SOPInstanceUID; z, t, and u will be set to 0 if no frame with the given SOPInstanceUID is not found. |
volumeIt | Output parameter: Set to the found volume or to end() if not found. |
forceSearchInEnhancedHandles | Input parameter: If true then in enhanced frame handles is always searched; if false then only if the frames are available or if it is a normal frame handles. |
alsoSearchInSMFTrees | Input parameter: If true then the tagId+Value is also searched in the DicomSMFTree of the volume if not found in frames; in this case foundHandle will be set to the will be set to the firstFileName of the volume and ztuPosition members will be set to 0 and empty value. |
dcmMsgCollector | I/O parameter: Collects error, info and issue messages (typically related to a handle). |
- Returns
- true if a frame with the given SOPInstanceUID is found, otherwise false.
◆ searchFrameWithValueInTag()
Returns file handle and position of the first frame in the first volume with tagValue in a tag with id tagId.
- Parameters
-
tagId | Input parameter: The id of the tag to be searched. |
tagValue | Input parameter: The tagValue to be searched in the frames. |
foundHandle | Output parameter: The file handle of the frame with tagValue in a tag with id tagId; will be empty if not found. |
ztuPosition | Output parameter: Will be set with z, t, and u indexes of the frame in the FileNameSet which has the given tagValue in a tag with id tagId; z, t, and u will be set to 0 if no frame with the given SOPInstanceUID is not found. |
volumeIt | Output parameter: Set to the found volume or to end() if not found. |
forceSearchInEnhancedHandles | Input parameter: If true then in enhanced frame handles is always searched; if false then only if the frames are available or if it is a normal frame handles. |
alsoSearchInSMFTrees | Input parameter: If true then the tagId+Value is also searched in the DicomSMFTree of the volume if not found in frames; in this case foundHandle will be set to the will be set to the firstFileName of the volume and ztuPosition members will be set to 0 and empty value. |
dcmMsgCollector | I/O parameter: Collects error, info and issue messages (typically related to a handle). |
- Returns
- true if a frame with the given tagValue in a tag with id tagId is found, otherwise false.
◆ searchVolumeIndexesWithValueInTag()
Returns a set of indexes to volumes which contain a frame with a tag with id tagId with value tagValue.
- Parameters
-
tagId | The id of the tag to be searched. |
tagValue | The tagValue to be searched in the frames. |
forceSearchInEnhancedHandles | If true then in enhanced frame handles is always searched; if false then only if the frames are available or if it is a normal frame handles. |
alsoSearchInSMFTrees | If true then the tagId+Value is also searched in the DicomSMFTree of the volume if not found in frames; in this case foundHandle will be set to the will be set to the firstFileName of the volume and ztuPosition members will be set to 0 and empty value. |
dcmMsgCollector | Collects error, info and issue messages (typically related to a handle). |
- Returns
- A vector with volume indexes or empty if not found.
◆ searchVolumesWithFramesWithValueInTag()
std::vector< MultiFileVolumeList::const_iterator > ml::MultiFileVolumeList::searchVolumesWithFramesWithValueInTag |
( |
unsigned int | tagId, |
|
|
const std::string & | tagValue, |
|
|
bool | forceSearchInEnhancedHandles, |
|
|
bool | alsoSearchInSMFTrees, |
|
|
DicomMessageCollector & | dcmMsgCollector ) const |
Returns a vector of iterators to volumes which contain a frame with a tag with id tagId with value tagValue.
- Parameters
-
tagId | The id of the tag to be searched. |
tagValue | The tagValue to be searched in the frames. |
forceSearchInEnhancedHandles | If true then in enhanced frame handles is searched if they exist; if false then only normal frame handles and SMF trees are scanned. |
alsoSearchInSMFTrees | If true then the tagId+Value is also searched in the DicomSMFTree of the volume if not found in frames; in this case foundHandle will be set to the will be set to the firstFileName of the volume and ztuPosition members will be set to 0 and empty value. |
dcmMsgCollector | Collects error, info and issue messages (typically related to a handle). |
- Returns
- A vector with volume iterators or empty if not found.
◆ setFromString()
Reads the state of this from the string state; returns ML_RESULT_OK on successful load and false on failure.
On other return codes the state of this remains undefined. The content of the string state is reduced by the loaded volumes.
- Parameters
-
state | The string from which the data is read. |
cacheDirPath | The directory path where the cache file is located which contains state. |
progressCB | An optional static function pointer which is then called by this function to notify the progress while this function is executed (as described in percentageRange). |
userData | a pointer with user data passed to progressCB. It for example can be used to pass the calling instance object which is updated. |
startPercentage | is the percentage value of a progress bar which is updated when this function starts (for example to 0.3). |
percentageRange | is the range incrementally stepped through while this method is executed, for example 0.5. The progress then is increased incrementally from percentageStart to percentageStart+percentageRange, thus from 0.3 to 0.8 by a number of steps whose number is determined inside of the function. |
cacheFileList | If passed nullptr then it is ignored, otherwise it will be filled with the names of all cache files belonging to this stored cache.
|
dcmMsgCollector | If passed non-nullptr then it collects error, info and issue messages (typically related to a handle). |
- Returns
- ML_RESULT_OK in case of success or another error code in case of failure. In case of failure state is left with undefined content.
◆ setUpIssues()
◆ sortVolumes()
◆ writeResultCache()
Writes all information into the cache file in the cache file directory.
Return ML_RESULT_OK on success, otherwise an error code describing the problem.
- Parameters
-
fileNameInput | the file name as it comes from the module input field. |
cachePathInput | the cache path as it comes from the module input field. |
useRelativePaths | If true the relative paths are stored in cache files, otherwise absolute paths. |
writeSingleVolumeCaches | If false one big cache file is written for all volume references, otherwise one for each one. |
progressLogger | If non nullptr then message are sent to this logger, otherwise it is ignored and messages are not logged. |
The documentation for this class was generated from the following file: