MeVisLab Toolbox Reference
mlReleaseToolsIO.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#include <mlAPI.h>
19
20// Calculates transformation from one directory to another.
21#include "mlDirectoryMatching.h"
22
23#include <list>
24
25ML_START_NAMESPACE
26
27// Forward of internally used classes.
28class MLImageFormat;
29class ProgressLogger;
30
31//----------------------------------------------------------------------------------
33//----------------------------------------------------------------------------------
34namespace ReleaseToolsIO {
35
36 //--------------------------------
37 // File suffix and type checks.
38 //--------------------------------
46 MLRELEASE_TOOLS_EXPORT bool isDICOMTiffPair(const std::string &oneFile,
47 std::string *otherFile=nullptr,
48 std::string *dcmFile=nullptr,
49 std::string *tiffFile=nullptr);
50
53 MLRELEASE_TOOLS_EXPORT bool hasMLImageSuffix(const std::string &filePathWithName) ML_RETURN_VALUE_SHOULD_BE_USED;
54
59 MLRELEASE_TOOLS_EXPORT bool isFileOrSuffixInList(const std::string &fileNamePath,
60 const std::vector<std::string> sufList) ML_RETURN_VALUE_SHOULD_BE_USED;
61
66 MLRELEASE_TOOLS_EXPORT std::string searchFileTypeInBinaryHeader(const std::string &fullFilePath) ML_RETURN_VALUE_SHOULD_BE_USED;
67
68
69 //--------------------------------
70 // Some simple path handling.
71 //--------------------------------
93 MLRELEASE_TOOLS_EXPORT std::string buildRelativePath(bool useRelativePaths,
94 const std::string &fileRootDirPath,
95 const std::string &fNamePath,
96 bool allowBranchedSubDirs=false,
97 bool allowMultiFrameHandles=false) ML_RETURN_VALUE_SHOULD_BE_USED;
98
104 MLRELEASE_TOOLS_EXPORT std::string removeRedundantPathComponents(const std::string &pathAndFileNameStr) ML_RETURN_VALUE_SHOULD_BE_USED;
105
107 MLRELEASE_TOOLS_EXPORT void removeRedundantPathComponents(const std::string &pathToSimplify, std::string &simplifiedPath);
108
112
128 MLRELEASE_TOOLS_EXPORT std::string buildAbsolutePath(bool allowMakeAbsolute,
129 const std::string &fileRootDirPath,
130 const std::string &relativeFileNameStr,
131 bool simplifyPaths=false,
132 bool allowMultiFrameHandles=false) ML_RETURN_VALUE_SHOULD_BE_USED;
133
135 MLRELEASE_TOOLS_EXPORT void buildAbsolutePath(bool allowMakeAbsolute,
136 const std::string fileRootDirPath,
137 const std::string &relativeFileNameStrIn,
138 bool simplifyPaths,
139 bool allowMultiFrameHandles,
140 std::string &relPathFileName);
141
146 MLRELEASE_TOOLS_EXPORT std::string appendSingleSlash(const std::string &srcStr) ML_RETURN_VALUE_SHOULD_BE_USED;
147
198 MLRELEASE_TOOLS_EXPORT std::vector<std::string> splitFilePath(const std::string &pathLikeString) ML_RETURN_VALUE_SHOULD_BE_USED;
199
201 MLRELEASE_TOOLS_EXPORT void splitFilePath(const std::string &pathLikeString, std::vector<std::string> &retPath);
202
212 MLRELEASE_TOOLS_EXPORT void splitPathAndName(std::string fullPathAndName,
213 std::string &fPath,
214 std::string &fName);
215
220 MLRELEASE_TOOLS_EXPORT std::string substituteNonPathLikeChars(std::string strToCorrect) ML_RETURN_VALUE_SHOULD_BE_USED;
221
222
223 //--------------------------------
224 // Save/load tool functions.
225 //--------------------------------
234 MLRELEASE_TOOLS_EXPORT MLErrorCode loadStringFile(const std::string &strFileName,
235 std::string &readString) ML_RETURN_VALUE_SHOULD_BE_USED;
236
260 MLint frameOffset,
261 SubImage &outSubImg,
262 size_t dimIdx,
263 bool isInterleaved,
264 MLint timeUnrollSteps) ML_RETURN_VALUE_SHOULD_BE_USED;
265
299 const std::string &sourceDir,
300 const std::vector<std::string> *suppressedFilesAndSuffixes,
301 bool recursively,
302 std::vector<std::string> &resultFileVector,
303 std::vector<std::string> *resultDirVector=nullptr,
304 bool returnRelativePaths=false,
305 bool alsoSuppressDirectories=false,
306 bool warnNoSourceSourceDir=false,
307 float progressMinimum=0.0,
308 float progressMaximum=1.0,
309 std::vector<std::string> *checkForFileExtensions = nullptr,
310 bool *checkForFileExtensionsFound = nullptr);
311
318 MLRELEASE_TOOLS_EXPORT MLErrorCode deleteListOfFiles(std::list<std::string> *fileNameList,
319 ProgressLogger *progressLogger = nullptr);
320
321};
322
323ML_END_NAMESPACE
Project global and OS specific declarations.
#define MLRELEASE_TOOLS_EXPORT
DLL export macro definition.
MLint32 MLErrorCode
Type of an ML Error code.
Definition mlTypeDefs.h:715
Tool function(s) to determine translation information from one directory to another.
MLint64 MLint
Definition mlTypeDefs.h:489
MLRELEASE_TOOLS_EXPORT std::string removeRedundantPathComponents(const std::string &pathAndFileNameStr) ML_RETURN_VALUE_SHOULD_BE_USED
MLRELEASE_TOOLS_EXPORT std::string buildRelativePath(bool useRelativePaths, const std::string &fileRootDirPath, const std::string &fNamePath, bool allowBranchedSubDirs=false, bool allowMultiFrameHandles=false) ML_RETURN_VALUE_SHOULD_BE_USED
MLRELEASE_TOOLS_EXPORT MLErrorCode loadStringFile(const std::string &strFileName, std::string &readString) ML_RETURN_VALUE_SHOULD_BE_USED
MLRELEASE_TOOLS_EXPORT bool isDICOMTiffPair(const std::string &oneFile, std::string *otherFile=nullptr, std::string *dcmFile=nullptr, std::string *tiffFile=nullptr)
MLRELEASE_TOOLS_EXPORT std::string searchFileTypeInBinaryHeader(const std::string &fullFilePath) ML_RETURN_VALUE_SHOULD_BE_USED
MLRELEASE_TOOLS_EXPORT MLErrorCode reformatColorChannels(const std::vector< SubImage > &frameSubImgs, MLint frameOffset, SubImage &outSubImg, size_t dimIdx, bool isInterleaved, MLint timeUnrollSteps) ML_RETURN_VALUE_SHOULD_BE_USED
MLRELEASE_TOOLS_EXPORT std::string buildAbsolutePath(bool allowMakeAbsolute, const std::string &fileRootDirPath, const std::string &relativeFileNameStr, bool simplifyPaths=false, bool allowMultiFrameHandles=false) ML_RETURN_VALUE_SHOULD_BE_USED
MLRELEASE_TOOLS_EXPORT std::vector< std::string > splitFilePath(const std::string &pathLikeString) ML_RETURN_VALUE_SHOULD_BE_USED
MLRELEASE_TOOLS_EXPORT bool isFileOrSuffixInList(const std::string &fileNamePath, const std::vector< std::string > sufList) ML_RETURN_VALUE_SHOULD_BE_USED
MLRELEASE_TOOLS_EXPORT MLErrorCode deleteListOfFiles(std::list< std::string > *fileNameList, ProgressLogger *progressLogger=nullptr)
MLRELEASE_TOOLS_EXPORT void removeRedundantPathComponentsInPlace(std::string &pathToSimplify)
MLRELEASE_TOOLS_EXPORT bool hasMLImageSuffix(const std::string &filePathWithName) ML_RETURN_VALUE_SHOULD_BE_USED
MLRELEASE_TOOLS_EXPORT std::string appendSingleSlash(const std::string &srcStr) ML_RETURN_VALUE_SHOULD_BE_USED
MLRELEASE_TOOLS_EXPORT bool scanDirectoriesForFiles(ProgressLogger *progressLogger, const std::string &sourceDir, const std::vector< std::string > *suppressedFilesAndSuffixes, bool recursively, std::vector< std::string > &resultFileVector, std::vector< std::string > *resultDirVector=nullptr, bool returnRelativePaths=false, bool alsoSuppressDirectories=false, bool warnNoSourceSourceDir=false, float progressMinimum=0.0, float progressMaximum=1.0, std::vector< std::string > *checkForFileExtensions=nullptr, bool *checkForFileExtensionsFound=nullptr)
MLRELEASE_TOOLS_EXPORT void splitPathAndName(std::string fullPathAndName, std::string &fPath, std::string &fName)
MLRELEASE_TOOLS_EXPORT std::string substituteNonPathLikeChars(std::string strToCorrect) ML_RETURN_VALUE_SHOULD_BE_USED
STL namespace.