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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
//! ImagingSelection
//!
//! URL: http://hl7.org/fhir/StructureDefinition/ImagingSelection
//!
//! Version: 5.0.0
//!
//! ImagingSelection Resource: A selection of DICOM SOP instances and/or frames within a single Study and Series.
//!
//! FHIR: <https://build.fhir.org/>
//!
//! UML: <https://build.fhir.org/uml.html>
// Allow unused crate::r5::types as types;
#![allow(unused_imports)]
use crate::r5::types;
use ::serde::{Deserialize, Serialize};
use fhir_derive_macros::Validate;
/// ImagingSelection is a selection of DICOM SOP instances and/or frames within a
/// single Study and Series.
///
/// In FHIR R5 this resource captures a curated, addressable subset of medical imaging
/// data by referencing DICOM Study, Series, and SOP Instance UIDs, and optionally narrowing
/// the selection further to individual frames or to specific 2D image regions or 3D regions
/// within a frame of reference. It is used to record clinically or scientifically significant
/// findings, key images, annotations, or measurement targets that a clinician, radiologist,
/// or automated process wishes to highlight, share, or act upon, rather than the entire study.
///
/// A selection may additionally include specifics such as an image region, an Observation
/// UID, or a Segmentation Number, allowing linkage to an Observation Resource or transferring
/// this information along with the ImagingStudy Resource. Typical uses include tumor boards,
/// teaching files, quantitative imaging biomarkers, structured reporting, and clinical
/// decision support, where precise portions of imaging data must be referenced unambiguously
/// across systems while pointing back to the source study and a retrieval endpoint.
///
/// # Related resources
///
/// The imaging data is generally derived from an [`ImagingStudy`](crate::r5::resources::imaging_study::ImagingStudy),
/// the subject is commonly a [`Patient`](crate::r5::resources::patient::Patient), and a
/// selection is frequently referenced by an [`Observation`](crate::r5::resources::observation::Observation).
/// Coded elements use [`CodeableConcept`](crate::r5::types::CodeableConcept) and
/// [`Coding`](crate::r5::types::Coding), while linkages to other resources use
/// [`Reference`](crate::r5::types::Reference).
///
/// # Examples
///
/// ```
/// use fhir::r5::resources::imaging_selection::ImagingSelection;
///
/// let value = ImagingSelection::default();
/// let json = ::serde_json::to_value(&value).unwrap();
/// let back: ImagingSelection = ::serde_json::from_value(json).unwrap();
/// assert_eq!(value, back);
/// ```
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct ImagingSelection {
/// Logical id of this artifact
pub id: Option<types::String>,
/// Metadata about the resource
pub meta: Option<types::Meta>,
/// A set of rules under which this content was created
pub implicit_rules: Option<types::Uri>,
/// Language of the resource content
pub language: Option<types::Code>,
/// Text summary of the resource, for human interpretation
pub text: Option<types::Narrative>,
/// Contained, inline Resources
pub contained: Option<Vec<::serde_json::Value>>,
/// Additional content defined by implementations
pub extension: Option<Vec<types::Extension>>,
/// Extensions that cannot be ignored
pub modifier_extension: Option<Vec<types::Extension>>,
/// Business Identifier for Imaging Selection
pub identifier: Option<Vec<types::Identifier>>,
/// Status of the imaging selection: available, entered-in-error, or unknown.
pub status: types::Code,
/// Subject of the selected instances, typically the Patient whose images are referenced.
pub subject: Option<types::Reference>,
/// Date / Time when this imaging selection was created
pub issued: Option<types::Instant>,
/// Selector of the instances (human or machine)
pub performer: Option<Vec<ImagingSelectionPerformer>>,
/// Associated request
pub based_on: Option<Vec<types::Reference>>,
/// Classifies the imaging selection
pub category: Option<Vec<types::CodeableConcept>>,
/// Reason for or purpose of this imaging selection, expressed as text or a coded concept.
pub code: types::CodeableConcept,
/// DICOM Study Instance UID identifying the study that contains the selected instances.
pub study_uid: Option<types::Id>,
/// The imaging study, commonly an ImagingStudy, from which this selection is derived.
pub derived_from: Option<Vec<types::Reference>>,
/// The network service providing retrieval for the images referenced in the imaging selection
pub endpoint: Option<Vec<types::Reference>>,
/// DICOM Series Instance UID
pub series_uid: Option<types::Id>,
/// DICOM Series Number
pub series_number: Option<types::UnsignedInt>,
/// The Frame of Reference UID for the selected images
pub frame_of_reference_uid: Option<types::Id>,
/// Body part examined
pub body_site: Option<types::CodeableReference>,
/// Related resource that is the focus for the imaging selection
pub focus: Option<Vec<types::Reference>>,
/// The selected instances
pub instance: Option<Vec<ImagingSelectionInstance>>,
}
/// Selector of the instances (human or machine).
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct ImagingSelectionPerformer {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
pub extension: Option<Vec<types::Extension>>,
/// Extensions that cannot be ignored even if unrecognized
pub modifier_extension: Option<Vec<types::Extension>>,
/// Type of performer
pub function: Option<types::CodeableConcept>,
/// Author (human or machine)
pub actor: Option<types::Reference>,
}
/// The selected instances.
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct ImagingSelectionInstance {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
pub extension: Option<Vec<types::Extension>>,
/// Extensions that cannot be ignored even if unrecognized
pub modifier_extension: Option<Vec<types::Extension>>,
/// DICOM SOP Instance UID
pub uid: types::Id,
/// DICOM Instance Number
pub number: Option<types::UnsignedInt>,
/// DICOM SOP Class UID
pub sop_class: Option<types::Coding>,
/// The selected subset of the SOP Instance
pub subset: Option<Vec<types::String>>,
/// A specific 2D region in a DICOM image / frame
pub image_region2_d: Option<Vec<ImagingSelectionInstanceImageRegion2D>>,
/// A specific 3D region in a DICOM frame of reference
pub image_region3_d: Option<Vec<ImagingSelectionInstanceImageRegion3D>>,
}
/// A specific 2D region in a DICOM image / frame.
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct ImagingSelectionInstanceImageRegion2D {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
pub extension: Option<Vec<types::Extension>>,
/// Extensions that cannot be ignored even if unrecognized
pub modifier_extension: Option<Vec<types::Extension>>,
/// point | polyline | interpolated | circle | ellipse
pub region_type: types::Code,
/// Specifies the coordinates that define the image region
pub coordinate: Vec<types::Decimal>,
}
/// A specific 3D region in a DICOM frame of reference.
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct ImagingSelectionInstanceImageRegion3D {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
pub extension: Option<Vec<types::Extension>>,
/// Extensions that cannot be ignored even if unrecognized
pub modifier_extension: Option<Vec<types::Extension>>,
/// point | multipoint | polyline | polygon | ellipse | ellipsoid
pub region_type: types::Code,
/// Specifies the coordinates that define the image region
pub coordinate: Vec<types::Decimal>,
}
#[cfg(test)]
mod tests {
use super::*;
type T = ImagingSelection;
#[test]
fn test_default() {
let _ = T::default();
}
#[test]
fn test_serde_round_trip() {
let value = T::default();
let json = ::serde_json::to_value(&value).expect("to_value");
let back: T = ::serde_json::from_value(json).expect("from_value");
assert_eq!(value, back);
}
}