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
|
/*
Copyright (C) 1993, 1994, RSNA and Washington University
The software and supporting documentation for the Radiological
Society of North America (RSNA) 1993, 1994 Digital Imaging and
Communications in Medicine (DICOM) Demonstration were developed
at the
Electronic Radiology Laboratory
Mallinckrodt Institute of Radiology
Washington University School of Medicine
510 S. Kingshighway Blvd.
St. Louis, MO 63110
as part of the 1993, 1994 DICOM Central Test Node project for, and
under contract with, the Radiological Society of North America.
THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND NEITHER RSNA NOR
WASHINGTON UNIVERSITY MAKE ANY WARRANTY ABOUT THE SOFTWARE, ITS
PERFORMANCE, ITS MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
USE, FREEDOM FROM ANY COMPUTER DISEASES OR ITS CONFORMITY TO ANY
SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND PERFORMANCE OF
THE SOFTWARE IS WITH THE USER.
Copyright of the software and supporting documentation is
jointly owned by RSNA and Washington University, and free access
is hereby granted as a license to use this software, copy this
software and prepare derivative works based upon this software.
However, any distribution of this software source code or
supporting documentation or derivative works (source code and
supporting documentation) must include the three paragraphs of
the copyright notice.
*/
/* Copyright marker. Copyright will be inserted above. Do not remove */
/*
** DICOM 93
** Electronic Radiology Laboratory
** Mallinckrodt Institute of Radiology
** Washington University School of Medicine
**
** Module Name(s): dbquerytest (main())
** printpat
** printstudy
** printseries
** printimage
** Author, Date: David E. Beecher, 4-Jul-93
** Intent: Code example for using the query mechanism.
** Last Update: $Author: smm $, $Date: 1994-12-30 18:22:28 $
** Source File: $RCSfile: dbquerytest.c,v $
** Revision: $Revision: 1.7 $
** Status: $State: Exp $
*/
static char rcsid[] = "$Revision: 1.7 $ $RCSfile: dbquerytest.c,v $";
#include <stdio.h>
#include "dicom.h"
#include "dbquery.h"
void printpat(PatientLevel pat, int i);
void printstudy(StudyLevel study, int i);
void printseries(SeriesLevel series, int i);
void printimage(ImageLevel image, int i);
main(int argc, char *argv[])
{
CONDITION
ret;
int
i;
short
id;
PatientLevel
pat;
char
patid[50],
dbname[50];
Query
spec, info;
spec.QueryState = DB_K_CLASSPAT;
spec.QueryState |= DB_K_LEVELIMAGE;
spec.Patient.Query_Flag = 0;
/*
spec.Patient.Query_Flag |= DB_K_QNAME;
spec.Patient.Query_Flag |= DB_K_QBIRTHDATE;
spec.Patient.Query_Flag |= DB_K_QID;
*/
spec.Study.Query_Flag = 0;
/*
spec.Study.Query_Flag |= DB_K_QSTUDYDATE;
spec.Study.Query_Flag |= DB_K_QSTUDYTIME;
spec.Study.Query_Flag |= DB_K_QSTUDYID;
spec.Study.Query_Flag |= DB_K_QACCESSIONNUMBER;
spec.Study.Query_Flag |= DB_K_QSTUDYUID;
spec.Study.Query_Flag |= DB_K_QREFERRINGPHYSNAME;
spec.Study.Query_Flag |= DB_K_QINTERPRETINGPHYSNAME;
spec.Study.Query_Flag |= DB_K_QPROCEDUREDESCRIPTION;
*/
spec.Study.Query_Flag |= DB_K_QADMITTINGDIAGNOSEDDESCRIPTION;
spec.Series.Query_Flag = 0;
/*
spec.Series.Query_Flag |= DB_K_QMODALITY;
spec.Series.Query_Flag |= DB_K_QSERIESNUMBER;
spec.Series.Query_Flag |= DB_K_QSERIESUID;
*/
spec.Image.Query_Flag = 0;
/*
spec.Image.Query_Flag |= DB_K_QIMAGENUMBER;
spec.Image.Query_Flag |= DB_K_QIMAGEUID;
spec.Image.Query_Flag |= DB_K_QCLASSUID;
spec.Image.Query_Flag |= DB_K_QIMAGEMULTUID;
*/
strcpy(spec.Patient.Name, "*");
strcpy(spec.Patient.PatID, "");
strcpy(spec.Patient.BirthDate, "");
strcpy(spec.Study.StudyDate, "");
strcpy(spec.Study.StudyTime, "");
strcpy(spec.Study.StudyID, "");
strcpy(spec.Study.AccessionNumber, "");
strcpy(spec.Study.StudyUID, "");
strcpy(spec.Study.ReferringPhysName, "");
strcpy(spec.Study.InterpretingPhysName, "");
strcpy(spec.Study.ProcedureDescription, "");
strcpy(spec.Study.AdmittingDiagnosedDescription, "*D*");
strcpy(spec.Series.Modality, "");
strcpy(spec.Series.SeriesNumber, "");
strcpy(spec.Series.SeriesUID, "");
strcpy(spec.Image.ImageNumber, "");
strcpy(spec.Image.ImageUID, "");
strcpy(spec.Image.ClassUID, "");
if (DB_Open("db.NEW.DEC", &id) == DB_NORMAL)
printf("DB_Open succeeded\n");
else {
printf("DB_Open failed\n");
exit(1);
}
if (DB_Query(id, &spec, &info) == DB_NORMAL) {
i = 1;
printpat(info.Patient, i);
if (!(spec.QueryState & DB_K_LEVELPAT)) {
printstudy(info.Study, i);
if (!(spec.QueryState & DB_K_LEVELSTUDY)) {
printseries(info.Series, i);
if (!(spec.QueryState & DB_K_LEVELSERIES)) {
printimage(info.Image, i);
}
}
}
while (DB_NextQuery(id, &spec, &info) == DB_NORMAL) {
i++;
printpat(info.Patient, i);
if (!(spec.QueryState & DB_K_LEVELPAT)) {
printstudy(info.Study, i);
if (!(spec.QueryState & DB_K_LEVELSTUDY)) {
printseries(info.Series, i);
if (!(spec.QueryState & DB_K_LEVELSERIES)) {
printimage(info.Image, i);
}
}
}
}
}
if (DB_Close(id) == DB_NORMAL)
printf("DB_Close succeeded\n");
else
exit(0);
}
/* printpat
**
** Purpose:
** Print characteristics of patient record
**
** Parameter Dictionary:
** pat Patient level record
** i Patient number
**
** Return Values:
** NOne
**
** Notes:
**
** Algorithm:
** Description of the algorithm (optional) and any other notes.
*/
void
printpat(PatientLevel pat, int i)
{
printf("Patient #%d\n", i);
printf(" Birth: %s\n", pat.BirthDate);
printf(" Name: %s\n", pat.Name);
printf(" PatID: %s\n\n", pat.PatID);
return;
}
/* printstudy
**
** Purpose:
** Print characteristics of the study record
**
** Parameter Dictionary:
** study Study level record
** i Study number
**
** Return Values:
** None
**
** Notes:
**
** Algorithm:
** Description of the algorithm (optional) and any other notes.
*/
void
printstudy(StudyLevel study, int i)
{
printf("Study #%d\n", i);
printf(" Study Date: %s\n", study.StudyDate);
printf(" Study Time: %s\n", study.StudyTime);
printf(" Study ID: %s\n", study.StudyID);
printf("Accession Number: %s\n", study.AccessionNumber);
printf(" Study UID: %s\n", study.StudyUID);
printf(" Referring: %s\n", study.ReferringPhysName);
printf(" Interpreting: %s\n", study.InterpretingPhysName);
printf(" Procedure: %s\n", study.ProcedureDescription);
printf(" Diagnosed: %s\n\n", study.AdmittingDiagnosedDescription);
return;
}
/* printseries
**
** Purpose:
** Dump the characteristics of series level record
**
** Parameter Dictionary:
** series Series level record
** i Series number
**
** Return Values:
** None
**
** Notes:
**
** Algorithm:
** Description of the algorithm (optional) and any other notes.
*/
void
printseries(SeriesLevel series, int i)
{
printf("Series #%d\n", i);
printf(" Modality: %s\n", series.Modality);
printf(" Series Number: %s\n", series.SeriesNumber);
printf(" Series UID: %s\n", series.SeriesUID);
return;
}
/* printimage
**
** Purpose:
** Dump the image level record characteristics
**
** Parameter Dictionary:
** image Image level record
** i Image number
**
** Return Values:
** None
**
** Notes:
**
** Algorithm:
** Description of the algorithm (optional) and any other notes.
*/
void
printimage(ImageLevel image, int i)
{
printf("Image #%d\n", i);
printf("Image Number: %s\n", image.ImageNumber);
printf(" Image UID: %s\n", image.ImageUID);
printf(" Class UID: %s\n", image.ClassUID);
printf(" FileName: %s\n\n", image.FileName);
return;
}
|