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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
//! 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>,
/// Primitive extension sibling for [`implicit_rules`](Self::implicit_rules) (FHIR `_implicitRules`).
#[serde(rename = "_implicitRules")]
pub implicit_rules_ext: Option<types::Element>,
/// Language of the resource content
pub language: Option<types::Code>,
/// Primitive extension sibling for [`language`](Self::language) (FHIR `_language`).
#[serde(rename = "_language")]
pub language_ext: Option<types::Element>,
/// Text summary of the resource, for human interpretation
pub text: Option<types::Narrative>,
/// Contained, inline Resources
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub contained: Vec<::serde_json::Value>,
/// Additional content defined by implementations
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: Vec<types::Extension>,
/// Business Identifier for Imaging Selection
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub identifier: Vec<types::Identifier>,
/// Status of the imaging selection: available, entered-in-error, or unknown.
pub status: crate::r5::coded::Coded<crate::r5::codes::ImagingselectionStatus>,
/// Primitive extension sibling for [`status`](Self::status) (FHIR `_status`).
#[serde(rename = "_status")]
pub status_ext: Option<types::Element>,
/// 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>,
/// Primitive extension sibling for [`issued`](Self::issued) (FHIR `_issued`).
#[serde(rename = "_issued")]
pub issued_ext: Option<types::Element>,
/// Selector of the instances (human or machine)
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub performer: Vec<ImagingSelectionPerformer>,
/// Associated request
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub based_on: Vec<types::Reference>,
/// Classifies the imaging selection
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub category: 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>,
/// Primitive extension sibling for [`study_uid`](Self::study_uid) (FHIR `_studyUid`).
#[serde(rename = "_studyUid")]
pub study_uid_ext: Option<types::Element>,
/// The imaging study, commonly an ImagingStudy, from which this selection is derived.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub derived_from: Vec<types::Reference>,
/// The network service providing retrieval for the images referenced in the imaging selection
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub endpoint: Vec<types::Reference>,
/// DICOM Series Instance UID
pub series_uid: Option<types::Id>,
/// Primitive extension sibling for [`series_uid`](Self::series_uid) (FHIR `_seriesUid`).
#[serde(rename = "_seriesUid")]
pub series_uid_ext: Option<types::Element>,
/// DICOM Series Number
pub series_number: Option<types::UnsignedInt>,
/// Primitive extension sibling for [`series_number`](Self::series_number) (FHIR `_seriesNumber`).
#[serde(rename = "_seriesNumber")]
pub series_number_ext: Option<types::Element>,
/// The Frame of Reference UID for the selected images
pub frame_of_reference_uid: Option<types::Id>,
/// Primitive extension sibling for [`frame_of_reference_uid`](Self::frame_of_reference_uid) (FHIR `_frameOfReferenceUid`).
#[serde(rename = "_frameOfReferenceUid")]
pub frame_of_reference_uid_ext: Option<types::Element>,
/// Body part examined
pub body_site: Option<types::CodeableReference>,
/// Related resource that is the focus for the imaging selection
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub focus: Vec<types::Reference>,
/// The selected instances
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub instance: 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
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored even if unrecognized
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: 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
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored even if unrecognized
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: Vec<types::Extension>,
/// DICOM SOP Instance UID
pub uid: types::Id,
/// Primitive extension sibling for [`uid`](Self::uid) (FHIR `_uid`).
#[serde(rename = "_uid")]
pub uid_ext: Option<types::Element>,
/// DICOM Instance Number
pub number: Option<types::UnsignedInt>,
/// Primitive extension sibling for [`number`](Self::number) (FHIR `_number`).
#[serde(rename = "_number")]
pub number_ext: Option<types::Element>,
/// DICOM SOP Class UID
pub sop_class: Option<types::Coding>,
/// The selected subset of the SOP Instance
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub subset: Vec<types::String>,
/// Primitive extension sibling for [`subset`](Self::subset) (FHIR `_subset`).
#[serde(rename = "_subset")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub subset_ext: Vec<Option<types::Element>>,
/// A specific 2D region in a DICOM image / frame
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub image_region2_d: Vec<ImagingSelectionInstanceImageRegion2D>,
/// A specific 3D region in a DICOM frame of reference
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub image_region3_d: Vec<ImagingSelectionInstanceImageRegion3D>,
}
/// A specific 2D region in a DICOM image / frame.
#[serde_with::skip_serializing_none]
#[derive(Debug, 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
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored even if unrecognized
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: Vec<types::Extension>,
/// point | polyline | interpolated | circle | ellipse
pub region_type: types::Code,
/// Primitive extension sibling for [`region_type`](Self::region_type) (FHIR `_regionType`).
#[serde(rename = "_regionType")]
pub region_type_ext: Option<types::Element>,
/// Specifies the coordinates that define the image region
pub coordinate: vec1::Vec1<types::Decimal>,
/// Primitive extension sibling for [`coordinate`](Self::coordinate) (FHIR `_coordinate`).
#[serde(rename = "_coordinate")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub coordinate_ext: Vec<Option<types::Element>>,
}
/// A specific 3D region in a DICOM frame of reference.
#[serde_with::skip_serializing_none]
#[derive(Debug, 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
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored even if unrecognized
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: Vec<types::Extension>,
/// point | multipoint | polyline | polygon | ellipse | ellipsoid
pub region_type: types::Code,
/// Primitive extension sibling for [`region_type`](Self::region_type) (FHIR `_regionType`).
#[serde(rename = "_regionType")]
pub region_type_ext: Option<types::Element>,
/// Specifies the coordinates that define the image region
pub coordinate: vec1::Vec1<types::Decimal>,
/// Primitive extension sibling for [`coordinate`](Self::coordinate) (FHIR `_coordinate`).
#[serde(rename = "_coordinate")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub coordinate_ext: Vec<Option<types::Element>>,
}
#[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);
}
}