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
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) ML_RETURN_VALUE_SHOULD_BE_USED;
61
67
68
69 //--------------------------------
70 // Some simple path handling.
71 //--------------------------------
94 const std::string &fileRootDirPath,
95 const std::string &fNamePath,
96 bool allowBranchedSubDirs=false,
98
105
107 MLRELEASE_TOOLS_EXPORT void removeRedundantPathComponents(const std::string &pathToSimplify, std::string &simplifiedPath);
108
111 MLRELEASE_TOOLS_EXPORT void removeRedundantPathComponentsInPlace(std::string &pathToSimplify);
112
128 MLRELEASE_TOOLS_EXPORT std::string buildAbsolutePath(bool allowMakeAbsolute,
129 const std::string &fileRootDirPath,
131 bool simplifyPaths=false,
133
135 MLRELEASE_TOOLS_EXPORT void buildAbsolutePath(bool allowMakeAbsolute,
136 const std::string fileRootDirPath,
138 bool simplifyPaths,
140 std::string &relPathFileName);
141
147
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
259 MLRELEASE_TOOLS_EXPORT MLErrorCode reformatColorChannels(const std::vector<SubImage> &frameSubImgs,
261 SubImage &outSubImg,
262 size_t dimIdx,
263 bool isInterleaved,
264 MLint timeUnrollSteps) ML_RETURN_VALUE_SHOULD_BE_USED;
265
298 MLRELEASE_TOOLS_EXPORT bool scanDirectoriesForFiles(ProgressLogger *progressLogger,
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,
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
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 which is organized linearly in memory.
Definition mlSubImage.h:75
MLint32 MLErrorCode
Type of an ML Error code.
Definition mlTypeDefs.h:716
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:490
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
Helper function to make a path relative if it matches a passed parent path.
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 std::string searchFileTypeInBinaryHeader(const std::string &fullFilePath) ML_RETURN_VALUE_SHOULD_BE_USED
If a known one is found then it returns the suffix corresponding to the format, otherwise an empty st...
MLRELEASE_TOOLS_EXPORT bool isFileOrSuffixInList(const std::string &fileNamePath, const std::vector< std::string > sufList) ML_RETURN_VALUE_SHOULD_BE_USED
Returns true if fileNamePath ends with a string in sufList which has a leading dot,...
MLRELEASE_TOOLS_EXPORT bool hasMLImageSuffix(const std::string &filePathWithName) ML_RETURN_VALUE_SHOULD_BE_USED
Returns true if the if filePathWithName ends with a string compatible with the .mlimage file format,...
STL namespace.