MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
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
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 //--------------------------------
47 std::string *otherFile=nullptr,
48 std::string *dcmFile=nullptr,
49 std::string *tiffFile=nullptr);
50
54
60 const std::vector<std::string> sufList);
61
67
68
69 //--------------------------------
70 // Some simple path handling.
71 //--------------------------------
94 const std::string &fileRootDirPath,
95 const std::string &fNamePath,
96 bool allowBranchedSubDirs=false,
97 bool allowMultiFrameHandles=false);
98
105
108
112
129 const std::string &fileRootDirPath,
130 const std::string &relativeFileNameStr,
131 bool simplifyPaths=false,
132 bool allowMultiFrameHandles=false);
133
136 const std::string fileRootDirPath,
137 const std::string &relativeFileNameStrIn,
138 bool simplifyPaths,
140 std::string &relPathFileName);
141
146 [[nodiscard]] MLRELEASE_TOOLS_EXPORT std::string appendSingleSlash(const std::string &srcStr);
147
198 [[nodiscard]] MLRELEASE_TOOLS_EXPORT std::vector<std::string> splitFilePath(const std::string &pathLikeString);
199
201 MLRELEASE_TOOLS_EXPORT void splitFilePath(const std::string &pathLikeString, std::vector<std::string> &retPath);
202
213 std::string &fPath,
214 std::string &fName);
215
221
222
223 //--------------------------------
224 // Save/load tool functions.
225 //--------------------------------
235 std::string &readString);
236
261 SubImage &outSubImg,
262 size_t dimIdx,
263 bool isInterleaved,
264 MLint timeUnrollSteps);
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
319 ProgressLogger *progressLogger = nullptr);
320
321};
322
Project global and OS specific declarations.
#define MLRELEASE_TOOLS_EXPORT
DLL export macro definition.
Configurable logger and progress handler class which can be used as base class for logging,...
This class manages/represents a rectangular 6D image region that is organized linearly in memory.
Definition mlSubImage.h:75
MLint32 MLErrorCode
Type of an ML Error code.
Definition mlTypeDefs.h:772
Tool function(s) to determine translation information from one directory to another.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
Definition mlTypeDefs.h:489
MLRELEASE_TOOLS_EXPORT std::vector< std::string > splitFilePath(const std::string &pathLikeString)
Splits a (path) string into its components.
MLRELEASE_TOOLS_EXPORT std::string buildAbsolutePath(bool allowMakeAbsolute, const std::string &fileRootDirPath, const std::string &relativeFileNameStr, bool simplifyPaths=false, bool allowMultiFrameHandles=false)
Helper function to make a relative path name absolute under some circumstances.
MLRELEASE_TOOLS_EXPORT bool isDICOMTiffPair(const std::string &oneFile, std::string *otherFile=nullptr, std::string *dcmFile=nullptr, std::string *tiffFile=nullptr)
Returns true if oneFile is one of two files of a DICOM/Tiff pair, otherwise false.
MLRELEASE_TOOLS_EXPORT MLErrorCode reformatColorChannels(const std::vector< SubImage > &frameSubImgs, MLint frameOffset, SubImage &outSubImg, size_t dimIdx, bool isInterleaved, MLint timeUnrollSteps)
Helper function to copy data from frameSubImages into outSubImg into the dimension given by dimIdx.
MLRELEASE_TOOLS_EXPORT std::string substituteNonPathLikeChars(std::string strToCorrect)
Small helper function to replace some characters not suitable for paths by '-' or '.
MLRELEASE_TOOLS_EXPORT bool hasMLImageSuffix(const std::string &filePathWithName)
Returns true if the if filePathWithName ends with a string compatible with the .mlimage file format,...
MLRELEASE_TOOLS_EXPORT std::string appendSingleSlash(const std::string &srcStr)
Appends a single forward slash to srcStr if it still does not end with one, however,...
MLRELEASE_TOOLS_EXPORT MLErrorCode deleteListOfFiles(std::list< std::string > *fileNameList, ProgressLogger *progressLogger=nullptr)
Tool function that deletes files for a given list of filenames.
MLRELEASE_TOOLS_EXPORT bool isFileOrSuffixInList(const std::string &fileNamePath, const std::vector< std::string > sufList)
Returns true if fileNamePath ends with a string in sufList which has a leading dot,...
MLRELEASE_TOOLS_EXPORT MLErrorCode loadStringFile(const std::string &strFileName, std::string &readString)
Load a binary file into readString and return ML_RESULT_OK on success, ML_FILE_IO_ERROR on other file...
MLRELEASE_TOOLS_EXPORT std::string buildRelativePath(bool useRelativePaths, const std::string &fileRootDirPath, const std::string &fNamePath, bool allowBranchedSubDirs=false, bool allowMultiFrameHandles=false)
Helper function to make a path relative if it matches a passed parent path.
MLRELEASE_TOOLS_EXPORT std::string searchFileTypeInBinaryHeader(const std::string &fullFilePath)
If a known one is found then it returns the suffix corresponding to the format, otherwise an empty st...
MLRELEASE_TOOLS_EXPORT void removeRedundantPathComponentsInPlace(std::string &pathToSimplify)
Same as removeRedundantPathComponents(const std::string &pathAndFileNameStr) but passing input into i...
MLRELEASE_TOOLS_EXPORT std::string removeRedundantPathComponents(const std::string &pathAndFileNameStr)
Removes ".."/ components from pathAndFileNameStr's such as "abc/xyz/../def" by reducing it to "abc/de...
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)
Searches files and directories optionally recursively in sourceDir; if suppressedFilesAndSuffixes is ...
MLRELEASE_TOOLS_EXPORT void splitPathAndName(std::string fullPathAndName, std::string &fPath, std::string &fName)
Splits the full path with file fullPathAndName into two components, the base path and the fileName at...