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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
|
/************************************************************************
*
* Copyright (C) 2009-2024 IRCAD France
* Copyright (C) 2012-2020 IHU Strasbourg
*
* 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/data/config.hpp>
#include "data/dicom_series.hpp"
#include "data/factory/new.hpp"
#include "data/reconstruction.hpp"
#include "data/series.hpp"
#include "data/types.hpp"
#include "fiducials_series.hpp"
#include "has_fiducials.hpp"
#include <core/com/signal.hpp>
#include <core/com/signals.hpp>
#include <vector>
namespace sight::data
{
/**
* @brief Holds models series.
*/
class SIGHT_DATA_CLASS_API model_series final : public series,
public has_fiducials
{
public:
using reconstruction_vector_t = std::vector<reconstruction::sptr>;
SIGHT_DECLARE_CLASS(model_series, series);
/**
* @brief Creates the models series.
*/
SIGHT_DATA_API model_series();
/// Destroys the models series.
SIGHT_DATA_API ~model_series() noexcept override = default;
/// Gets the reconstruction container use to store mesh, material and image mask.
const reconstruction_vector_t& get_reconstruction_db() const;
/// Sets the reconstruction container use to store mesh, material and image mask.
void set_reconstruction_db(const reconstruction_vector_t& _val);
/// Gets the DICOM reference use to generate valid DICOM Segmentation Surface.
dicom_series::csptr get_dicom_reference() const;
/// Sets the DICOM reference use to generate valid DICOM Segmentation Surface.
void set_dicom_reference(const dicom_series::csptr& _reference);
/**
* @name Signals
* @{
*/
/// Defines the type of signal sent when a reconstruction is added.
using reconstructions_added_signal_t = core::com::signal<void (reconstruction_vector_t)>;
SIGHT_DATA_API static const core::com::signals::key_t RECONSTRUCTIONS_ADDED_SIG;
/// Defines the type of signal sent when a reconstruction is removed.
using reconstructions_removed_signal_t = core::com::signal<void (reconstruction_vector_t)>;
SIGHT_DATA_API static const core::com::signals::key_t RECONSTRUCTIONS_REMOVED_SIG;
/**
* @}
*/
/// Equality comparison operators
/// @{
SIGHT_DATA_API bool operator==(const model_series& _other) const noexcept;
SIGHT_DATA_API bool operator!=(const model_series& _other) const noexcept;
/// @}
/// Defines shallow copy
/// @throws data::exception if an errors occurs during copy
/// @param[in] _source the source object to copy
SIGHT_DATA_API void shallow_copy(const object::csptr& _source) override;
/// Defines deep copy
/// @throws data::exception if an errors occurs during copy
/// @param _source source object to copy
/// @param _cache cache used to deduplicate pointers
SIGHT_DATA_API void deep_copy(
const object::csptr& _source,
const std::unique_ptr<deep_copy_cache_t>& _cache = std::make_unique<deep_copy_cache_t>()
) override;
protected:
/// Stores models.
reconstruction_vector_t m_reconstruction_db;
/// Stores the DICOM reference used to generate a valid DICOM Segmentation Surface.
dicom_series::sptr m_dicom_reference;
private:
/// Stores the signal emitted when reconstructions are added.
reconstructions_added_signal_t::sptr m_sig_reconstructions_added;
/// Stores the signal emitted when reconstructions are removed.
reconstructions_removed_signal_t ::sptr m_sig_reconstructions_removed;
};
//-----------------------------------------------------------------------------
inline const model_series::reconstruction_vector_t& model_series::get_reconstruction_db() const
{
return m_reconstruction_db;
}
//-----------------------------------------------------------------------------
inline void model_series::set_reconstruction_db(const model_series::reconstruction_vector_t& _val)
{
m_reconstruction_db = _val;
}
//-----------------------------------------------------------------------------
inline dicom_series::csptr model_series::get_dicom_reference() const
{
return m_dicom_reference;
}
//-----------------------------------------------------------------------------
inline void model_series::set_dicom_reference(const dicom_series::csptr& _reference)
{
m_dicom_reference = std::const_pointer_cast<dicom_series>(_reference);
}
//-----------------------------------------------------------------------------
} // namespace sight::data
|