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
|
/************************************************************************
*
* Copyright (C) 2018-2025 IRCAD France
* Copyright (C) 2018-2019 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 <data/integer.hpp>
#include <data/series_set.hpp>
#include <data/string.hpp>
#include <io/http/client_qt.hpp>
#include <ui/__/editor.hpp>
#include <QDateEdit>
#include <QLineEdit>
#include <QObject>
#include <QPointer>
#include <QPushButton>
#include <QWidget>
#include <filesystem>
namespace sight::module::io::dicomweb
{
/**
* @brief This editor service is used to perform an HTTP query on a Pacs.
*
* @section Slots Slots
* - \b displayErrorMessage(const std::string&) : display an error message.
* @section XML XML Configuration
*
* @code{.xml}
<service type="sight::module::io::dicomweb::query_editor">
<inout key="seriesSet" uid="..." />
<properties host_name="${host_name}" port="${port_id}" />
<config icon="..." />
</service>
@endcode
*
* @subsection In-Out In-Out:
* - \b seriesSet [sight::data::series_set]: series_set on which the queried data will be pushed.
*
* @subsection Properties Properties
* - \b host_name : Need hostname string (default value is "127.0.0.1").
* - \b port : Need the value of port (default value is 8042).
*
* @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 : public QObject,
public sight::ui::editor
{
Q_OBJECT;
public:
SIGHT_DECLARE_SERVICE(query_editor, sight::ui::editor);
/// Constructor
query_editor() noexcept;
/// Destructor
~query_editor() noexcept override;
protected:
/// Gets the configurations.
void configuring() override;
/// Creates the widgets & connect the signals.
void starting() override;
/// Disconnect the signals and destroy the widgets.
void stopping() override;
/// Does nothing.
void updating() override;
private Q_SLOTS:
/// Slot called when querying on patient name
void query_patient_name();
/// Slot called when querying on study date
void query_study_date();
private:
/**
* @brief Display an error message
* @param[in] _message Error message to display
*/
static void display_error_message(const std::string& _message);
/**
* @brief Update the series_set with the series retrieved from the pacs
* @param[in] _series Series which must be added to the series_set
*/
void update_series_set(const data::series_set::container_t& _series);
/// Patient Name field
QPointer<QLineEdit> m_patient_name_line_edit;
/// Patient Name Query Button
QPointer<QPushButton> m_patient_name_query_button;
/// Begin study date widget
QPointer<QDateEdit> m_begin_study_date_edit;
/// End study date widget
QPointer<QDateEdit> m_end_study_date_edit;
/// Study Date Query Button
QPointer<QPushButton> m_study_date_query_button;
/// Http Qt Client
sight::io::http::client_qt m_client_qt;
/// Server hostname preference key
std::string m_server_hostname_key;
/// Defines the path of the button's icon.
std::filesystem::path m_icon_path {};
/// Server port preference key
std::string m_server_port_key;
/// 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};
/// Defines if advanced fields are displayed.
bool m_advanced {true};
sight::data::ptr<sight::data::series_set, sight::data::access::inout> m_series_set {this, "series_set"};
sight::data::property<sight::data::string> m_server_hostname {this, "host_name", std::string("localhost")};
sight::data::property<sight::data::integer> m_server_port {this, "port", 4242};
};
} // namespace sight::module::io::dicomweb
|