TPCCLIB
Loading...
Searching...
No Matches
dcmsop.c
Go to the documentation of this file.
1
4/*****************************************************************************/
5#include "tpcclibConfig.h"
6/*****************************************************************************/
7#include <stdio.h>
8#include <stdlib.h>
9#include <math.h>
10#include <time.h>
11#include <string.h>
12/*****************************************************************************/
13#include "tpcextensions.h"
14/*****************************************************************************/
15#include "tpcdcm.h"
16/*****************************************************************************/
17
18/*****************************************************************************/
21typedef struct DCM_SOP_ITEM {
24 char uid[64];
26 char name[64];
27} DCM_SOP_ITEM;
28
32static DCM_SOP_ITEM dcm_sop[]={
33 {"invalid", "invalid SOP"}, // do not change this
34 {"1.2.840.10008.5.1.4.1.1.1", "Computed Radiography Image Storage"},
35 {"1.2.840.10008.5.1.4.1.1.12.1", "X-Ray Angiographic Image Storage"},
36 {"1.2.840.10008.5.1.4.1.1.128", "Positron Emission Tomography Image Storage"},
37 {"1.2.840.10008.5.1.4.1.1.130", "Enhanced PET Image Storage"},
38 {"1.2.840.10008.5.1.4.1.1.128.1", "Legacy Converted Enhanced PET Image Storage"},
39 {"1.2.840.10008.5.1.4.1.1.2", "CT Image Storage"},
40 {"1.2.840.10008.5.1.4.1.1.20", "NM Image Storage"},
41 {"1.2.840.10008.5.1.4.1.1.30", "Parametric Map Storage"},
42 {"1.2.840.10008.5.1.4.1.1.3.1", "Ultrasound Multiframe Image Storage"},
43 {"1.2.840.10008.5.1.4.1.1.4", "MR Image Storage"},
44 {"1.2.840.10008.5.1.4.1.1.4.1", "Enhanced MR Image Storage"},
45 {"1.2.840.10008.5.1.4.1.1.4.2", "MR Spectroscopy Storage"},
46 {"1.2.840.10008.5.1.4.1.1.6.1", "Ultrasound Image Storage"},
47 {"1.2.840.10008.5.1.4.1.1.66", "Raw Data Storage"},
48 {"1.2.840.10008.5.1.4.1.1.66.1", "Spatial Registration Storage"},
49 {"1.2.840.10008.5.1.4.1.1.66.2", "Spatial Fiducials Storage"},
50 {"1.2.840.10008.5.1.4.1.1.66.3", "Deformable Spatial Registration Storage"},
51 {"1.2.840.10008.5.1.4.1.1.66.4", "Segmentation Storage"},
52 {"unknown", "unknown SOP"} // do not change this
53};
55/*****************************************************************************/
56
57/*****************************************************************************/
62unsigned int dcmSOPIdentify(
64 const char *s
65) {
66 if(s==NULL || strnlen(s, 3)<3) return(0);
67
68 /* Identify the SOP UID */
69 unsigned int i=0;
70 while(strcmp(dcm_sop[i].uid, "unknown")!=0) {
71 if(strcmp(dcm_sop[i].uid, s)==0) return(i);
72 i++;
73 }
74 return(i);
75}
76/*****************************************************************************/
77
78/*****************************************************************************/
85 unsigned int i
86) {
87 unsigned int j=0;
88 while(strcmp(dcm_sop[j].uid, "unknown")!=0) {
89 if(i==j) return(dcm_sop[j].name);
90 j++;
91 }
92 return(dcm_sop[j].name);
93}
94/*****************************************************************************/
95
96/*****************************************************************************/
103 unsigned int i
104) {
105 unsigned int j=0;
106 while(strcmp(dcm_sop[j].uid, "unknown")!=0) {
107 if(i==j) return(dcm_sop[j].uid);
108 j++;
109 }
110 return(dcm_sop[j].uid);
111}
112/*****************************************************************************/
113
114/*****************************************************************************/
121 const char *s
122) {
123 if(s==NULL || strnlen(s, 3)<3) return(dcm_sop[0].name);
124
125 /* Identify the SOP UID */
126 unsigned int i=0;
127 while(strcmp(dcm_sop[i].uid, "unknown")!=0) {
128 if(strcmp(dcm_sop[i].uid, s)==0) return(dcm_sop[i].name);
129 i++;
130 }
131 return(dcm_sop[i].name);
132}
133/*****************************************************************************/
134
135/*****************************************************************************/
unsigned int dcmSOPIdentify(const char *s)
Definition dcmsop.c:62
char * dcmSOPUIDName(const char *s)
Definition dcmsop.c:119
char * dcmSOPUID(unsigned int i)
Definition dcmsop.c:101
char * dcmSOPName(unsigned int i)
Definition dcmsop.c:83
size_t strnlen(const char *s, size_t n)
Definition stringext.c:566
Header file for libtpcdcm.
Header file for library libtpcextensions.