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 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
|
/************************************************************************
*
* Copyright (C) 2020-2025 IRCAD France
* Copyright (C) 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 <core/thread/worker.hpp>
#include <data/series_set.hpp>
#include <io/dimse/data/pacs_configuration.hpp>
#include <io/dimse/series_enquirer.hpp>
#include <service/notifier.hpp>
#include <ui/__/editor.hpp>
#include <QDateEdit>
#include <QLineEdit>
#include <QObject>
#include <QPointer>
#include <QPushButton>
namespace sight::module::io::dimse
{
/**
* @brief This editor allows to perform queries on a pacs.
*
* Queries results are stored in a series_set.
*
* @section XML XML Configuration
* @code{.xml}
<service type="sight::module::io::dimse::query_editor">
<in key="pacsConfig" uid="..." />
<inout key="series_set" uid="..." />
<config icon="..." />
</service>
@endcode
*
* @subsection Input Input:
* - \b pacsConfig [sight::io::dimse::data::pacs_configuration]: PACS configuration data.
*
* @subsection In-Out In-Out:
* - \b series_set [sight::data::object]: series_set where to push the queried data.
*
* @subsection Configuration Configuration:
* - \b advanced (optional, bool, default=true): define if advanced fields are displayed.
* - \b icon (optional, string, default=""): path of the icon used in the search button.
* - \b width (optional, unsigned int, default=20): width of the icon used in the search button.
* - \b height (optional, unsigned int, default=20): height of the icon used in the search button.
*/
class query_editor final :
public QObject,
public sight::ui::editor,
private sight::service::notifier
{
Q_OBJECT;
public:
/// Generates default methods as New, dynamicCast, ...
SIGHT_DECLARE_SERVICE(query_editor, sight::ui::editor);
/// Creates the service.
query_editor() noexcept;
/// Destroyes the service.
~query_editor() noexcept override = default;
protected:
/// Configures the editor.
void configuring() override;
/// Creates the GUI and connects widget to updateSeriesSet(const data::series_set::container_t&).
void starting() override;
/// Executes a query with last settings.
void updating() override;
/// Destroys the GUI and disconnect signals.
void stopping() override;
private:
/// Executes a query and fills the result in the series set.
void execute_query();
/**
* @brief Adds series in the series set.
* @param _series series to add.
*/
void update_series_set(const data::series_set::container_t& _series);
/// Contains the worker of the series enquire thread.
core::thread::worker::sptr m_request_worker {nullptr};
/// Defines if the service is executing query.
std::atomic<bool> m_is_querying {false};
/// Defines if advanced fields are displayed.
bool m_advanced {true};
/// Defines the path of the button's icon.
std::filesystem::path m_icon_path;
/// Defines the with of the button's icon.
unsigned int m_icon_width {20};
/// Defines the height of the button's icon.
unsigned int m_icon_height {20};
/// Contains the search line editor.
QPointer<QLineEdit> m_search_edit;
/// Contains the search button.
QPointer<QPushButton> m_search_button;
/// Contains the begin date line editor.
QPointer<QDateEdit> m_begin_study_date_edit;
/// Contains the end date line editor.
QPointer<QDateEdit> m_end_study_date_edit;
/// Contains the name line editor.
QPointer<QLineEdit> m_patient_name_edit;
/// Contains the birth date line editor.
QPointer<QDateEdit> m_birth_date_edit;
/// Contains the patient id line editor.
QPointer<QLineEdit> m_patient_uid_edit;
/// Contains the uid line editor.
QPointer<QLineEdit> m_series_uid_edit;
/// Contains the description line editor.
QPointer<QLineEdit> m_series_description_edit;
/// Contains the modality line editor.
QPointer<QLineEdit> m_series_modality_edit;
private Q_SLOTS:
/// Executes a query and fills the result in the series set.
void execute_query_async();
/**
* @brief Enables the birth date editor.
* @param _enable value used as a boolean.
*/
void enable_birth_date_edit(int _enable);
private:
data::ptr<sight::io::dimse::data::pacs_configuration, data::access::in> m_config {this, "pacsConfig"};
data::ptr<sight::data::series_set, data::access::inout> m_series_set {this, "series_set"};
};
} // namespace sight::module::io::dimse.
|