MeshLib C++ Docs
Loading...
Searching...
No Matches
MRDicom.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRVoxelsFwd.h"
4#ifndef MRVOXELS_NO_DICOM
5#include "MRVoxelsVolume.h"
6
7#include "MRMesh/MRAffineXf.h"
8#include "MRMesh/MRMatrix3.h"
10
11#include <filesystem>
12#include <optional>
13
14namespace MR
15{
16
17namespace VoxelsLoad
18{
19
22MRVOXELS_API bool isDicomFile( const std::filesystem::path& path, std::string* seriesUid = nullptr );
23
25MRVOXELS_API bool isDicomFolder( const std::filesystem::path& dirPath );
26
27template <typename T>
29{
30 T vol;
31 std::string name;
32 AffineXf3f xf;
33};
34
37
38
41template <typename T = SimpleVolumeMinMax>
42MRVOXELS_API std::vector<Expected<DicomVolumeT<T>>> loadDicomsFolder( const std::filesystem::path& path,
43 unsigned maxNumThreads = 4, const ProgressCallback& cb = {} );
44
47template <typename T = SimpleVolumeMinMax>
48MRVOXELS_API Expected<DicomVolumeT<T>> loadDicomFolder( const std::filesystem::path& path,
49 unsigned maxNumThreads = 4, const ProgressCallback& cb = {} );
50
52MRVOXELS_API std::vector<Expected<DicomVolumeAsVdb>> loadDicomsFolderTreeAsVdb( const std::filesystem::path& path,
53 unsigned maxNumThreads = 4, const ProgressCallback& cb = {} );
54
57
59MRVOXELS_API Expected<LoadedObjectVoxels> makeObjectVoxelsFromDicomFolder( const std::filesystem::path& folder, const ProgressCallback& callback = {} );
60
62template <typename T = SimpleVolumeMinMax>
63MRVOXELS_API Expected<DicomVolumeT<T>> loadDicomFile( const std::filesystem::path& path, const ProgressCallback& cb = {} );
64
65} // namespace VoxelsLoad
66
67namespace VoxelsSave
68{
69
71MRVOXELS_API Expected<void> toDicom( const VdbVolume& vdbVolume, const std::filesystem::path& path, ProgressCallback cb = {} );
74template <typename T>
75MRVOXELS_API Expected<void> toDicom( const VoxelsVolume<std::vector<T>>& volume, const std::filesystem::path& path, const std::optional<MinMaxf>& sourceScale = {}, const ProgressCallback& cb = {} );
76
77} // namespace VoxelsSave
78
79} // namespace MR
80#endif
#define MRVOXELS_API
Definition MRVoxels/MRVoxelsFwd.h:13
std::function< bool(float)> ProgressCallback
Definition MRMesh/MRMeshFwd.h:600
MRVOXELS_API Expected< LoadedObjectVoxels > makeObjectVoxelsFromDicomFolder(const std::filesystem::path &folder, const ProgressCallback &callback={})
Loads 3D volumetric data from dicom-files in given folder, and converts them into an ObjectVoxels.
MRVOXELS_API Expected< DicomVolumeT< T > > loadDicomFile(const std::filesystem::path &path, const ProgressCallback &cb={})
Loads 3D volumetric data from a single DICOM file.
MRVOXELS_API Expected< std::shared_ptr< ObjectVoxels > > createObjectVoxels(const DicomVolumeAsVdb &dcm, const ProgressCallback &cb={})
converts DicomVolumeAsVdb in ObjectVoxels
MRVOXELS_API Expected< DicomVolumeT< T > > loadDicomFolder(const std::filesystem::path &path, unsigned maxNumThreads=4, const ProgressCallback &cb={})
MRVOXELS_API std::vector< Expected< DicomVolumeT< T > > > loadDicomsFolder(const std::filesystem::path &path, unsigned maxNumThreads=4, const ProgressCallback &cb={})
MRVOXELS_API bool isDicomFile(const std::filesystem::path &path, std::string *seriesUid=nullptr)
MRVOXELS_API std::vector< Expected< DicomVolumeAsVdb > > loadDicomsFolderTreeAsVdb(const std::filesystem::path &path, unsigned maxNumThreads=4, const ProgressCallback &cb={})
Loads every subfolder with DICOM volume as new object.
MRVOXELS_API bool isDicomFolder(const std::filesystem::path &dirPath)
check if given folder contains at least one DICOM file
MRVOXELS_API Expected< void > toDicom(const VdbVolume &vdbVolume, const std::filesystem::path &path, ProgressCallback cb={})
Save voxels objet to a single 3d DICOM file.
tl::expected< T, E > Expected
Definition MRExpected.h:58
Definition MRDicom.h:29
std::string name
Definition MRDicom.h:31
AffineXf3f xf
Definition MRDicom.h:32
T vol
Definition MRDicom.h:30
represents a box in 3D space subdivided on voxels stored in T
Definition MRVoxelsVolume.h:39