File: file.hpp

package info (click to toggle)
sight 25.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 42,180 kB
  • sloc: cpp: 289,476; xml: 17,257; ansic: 9,878; python: 1,379; sh: 144; makefile: 33
file content (97 lines) | stat: -rw-r--r-- 3,598 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/************************************************************************
 *
 * Copyright (C) 2022-2025 IRCAD France
 *
 * This file is part of Sight.
 *
 * Sight is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Sight is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with Sight. If not, see <https://www.gnu.org/licenses/>.
 *
 ***********************************************************************/

#pragma once

#include <sight/io/dicom/config.hpp>

#include <core/location/multiple_files.hpp>
#include <core/location/single_folder.hpp>

#include <data/series_set.hpp>

#include <io/__/reader/generic_object_reader.hpp>

namespace sight::io::dicom::reader
{

class SIGHT_IO_DICOM_CLASS_API file final : public io::reader::generic_object_reader<data::series_set>,
                                            public core::location::single_folder,
                                            public core::location::multiple_files,
                                            public core::com::has_signals
{
public:

    SIGHT_DECLARE_CLASS(file, io::reader::generic_object_reader<data::series_set>);

    SIGHT_IO_DICOM_API file();

    SIGHT_IO_DICOM_API ~file() noexcept override;

    /// Reads DICOM data
    SIGHT_IO_DICOM_API void read(SPTR(sight::core::progress::observer) _progress) override;

    inline std::string extension() const override;

    /// Returns a list of DICOM series by scanning files, either using get_files() or recursively using get_folder() as
    /// root directory.
    /// The files are NOT sorted!
    /// @return data::series_set::sptr: A set of series, with their associated files
    /// @throw std::runtime_error if the root directory is not an existing folder
    /// @throw std::runtime_error if there is no dicom files are found
    SIGHT_IO_DICOM_API data::series_set::sptr scan();

    /// Returns a list of DICOM series with their associated files sorted.
    /// Also call scan() if there is no scanned series.
    /// @return data::series_set::sptr and double: A set of series, with their associated files sorted, and the
    /// z_spacing
    SIGHT_IO_DICOM_API data::series_set::sptr sort();

    /// Getters/Setters
    /// @{

    /// Set SOP class filters to use when scanning for DICOM files (CTImageStorage, SpatialFiducialsStorage, ...).
    /// @param[in] _filters SOP class filters
    SIGHT_IO_DICOM_API void set_filters(const data::series::sop_keywords_t& _filters);

    /// Set the scanned Series list, unsorted
    /// @param[in] _scanned The Series with their associated files
    SIGHT_IO_DICOM_API void set_scanned(const data::series_set::sptr& _scanned);

    /// Set the sorted Series list. These are the series that will be read
    /// @param[in] _sorted The Series with their associated files
    SIGHT_IO_DICOM_API void set_sorted(const data::series_set::sptr& _sorted);
    /// @}

private:

    class reader_impl;
    std::unique_ptr<reader_impl> m_pimpl;
};

//------------------------------------------------------------------------------

inline std::string file::extension() const
{
    return ".dcm";
}

} // namespace sight::io::dicom::reader