comparison JavaSDK/be/uclouvain/orthanc/DicomToJsonFlags.java @ 0:3ecef5782f2c

initial commit
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 18 Oct 2023 17:59:44 +0200
parents
children 26c08ff926a3
comparison
equal deleted inserted replaced
-1:000000000000 0:3ecef5782f2c
1 package be.uclouvain.orthanc;
2
3 /**
4 * SPDX-FileCopyrightText: 2023 Sebastien Jodogne, UCLouvain, Belgium
5 * SPDX-License-Identifier: GPL-3.0-or-later
6 */
7
8 /**
9 * Java plugin for Orthanc
10 * Copyright (C) 2023 Sebastien Jodogne, UCLouvain, Belgium
11 *
12 * This program is free software: you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation, either version 3 of the
15 * License, or (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see http://www.gnu.org/licenses/.
24 **/
25
26
27 /**
28 * Flags to customize a DICOM-to-JSON conversion. By default, binary tags are
29 * formatted using Data URI scheme.
30 **/
31 public enum DicomToJsonFlags {
32 /**
33 * Default formatting
34 **/
35 NONE(0),
36 /**
37 * Include the binary tags
38 **/
39 INCLUDE_BINARY(1),
40 /**
41 * Include the private tags
42 **/
43 INCLUDE_PRIVATE_TAGS(2),
44 /**
45 * Include the tags unknown by the dictionary
46 **/
47 INCLUDE_UNKNOWN_TAGS(4),
48 /**
49 * Include the pixel data
50 **/
51 INCLUDE_PIXEL_DATA(8),
52 /**
53 * Output binary tags as-is, dropping non-ASCII
54 **/
55 CONVERT_BINARY_TO_ASCII(16),
56 /**
57 * Signal binary tags as null values
58 **/
59 CONVERT_BINARY_TO_NULL(32),
60 /**
61 * Stop processing after pixel data (new in 1.9.1)
62 **/
63 STOP_AFTER_PIXEL_DATA(64),
64 /**
65 * Skip tags whose element is zero (new in 1.9.1)
66 **/
67 SKIP_GROUP_LENGTHS(128);
68
69 private int value;
70
71 private DicomToJsonFlags(int value) {
72 this.value = value;
73 }
74
75 /**
76 * Return the enumeration value that corresponds to an integer value of interest.
77 * @param value The integer value.
78 * @return The enumeration value.
79 **/
80 protected static DicomToJsonFlags getInstance(int value) {
81 if (value == 0) {
82 return NONE;
83 }
84 if (value == 1) {
85 return INCLUDE_BINARY;
86 }
87 if (value == 2) {
88 return INCLUDE_PRIVATE_TAGS;
89 }
90 if (value == 4) {
91 return INCLUDE_UNKNOWN_TAGS;
92 }
93 if (value == 8) {
94 return INCLUDE_PIXEL_DATA;
95 }
96 if (value == 16) {
97 return CONVERT_BINARY_TO_ASCII;
98 }
99 if (value == 32) {
100 return CONVERT_BINARY_TO_NULL;
101 }
102 if (value == 64) {
103 return STOP_AFTER_PIXEL_DATA;
104 }
105 if (value == 128) {
106 return SKIP_GROUP_LENGTHS;
107 }
108
109 throw new IllegalArgumentException("Value out of range for enumeration DicomToJsonFlags: " + value);
110 }
111
112 /**
113 * Get the integer value corresponding to this enumeration value.
114 * @return The integer value.
115 **/
116 public int getValue() {
117 return value;
118 }
119 }