| 1 |
package DICOM.InfoObj; |
| 2 |
|
| 3 |
import DICOM.DICOMWrapper; |
| 4 |
import DICOM.Module.*; |
| 5 |
|
| 6 |
/* |
| 7 |
* CompositeFactory |
| 8 |
*/ |
| 9 |
|
| 10 |
|
| 11 |
public class CompositeFactory { |
| 12 |
|
| 13 |
public void setPatientModule(DICOM.DICOMWrapper wrapper, |
| 14 |
DICOM.Module.PatientModule patient) { |
| 15 |
String s = patient.patientName(); |
| 16 |
wrapper.setString(0x00100010, s); |
| 17 |
s = patient.patientID(); |
| 18 |
wrapper.setString(0x00100020, s); |
| 19 |
s = patient.birthDate(); |
| 20 |
wrapper.setString(0x00100030, s); |
| 21 |
s = patient.sex(); |
| 22 |
wrapper.setString(0x00100040, s); |
| 23 |
} |
| 24 |
|
| 25 |
public void setGeneralStudyModule(DICOM.DICOMWrapper w, |
| 26 |
DICOM.Module.GeneralStudyModule study) { |
| 27 |
String s = study.studyUID(); |
| 28 |
w.setString(0x0020000D, s); |
| 29 |
s = study.studyDate(); |
| 30 |
w.setString(0x00080020, s); |
| 31 |
s = study.studyTime(); |
| 32 |
w.setString(0x00080030, s); |
| 33 |
s = study.referringPhysician(); |
| 34 |
w.setString(0x00080090, s); |
| 35 |
s = study.studyID(); |
| 36 |
w.setString(0x00200010, s); |
| 37 |
s = study.accessionNumber(); |
| 38 |
w.setString(0x00080050, s); |
| 39 |
} |
| 40 |
|
| 41 |
public void setGeneralSeriesModule(DICOM.DICOMWrapper w, |
| 42 |
DICOM.Module.GeneralSeriesModule series) { |
| 43 |
String s = series.modality(); |
| 44 |
w.setString(0x00080060, s); |
| 45 |
s = series.seriesUID(); |
| 46 |
w.setString(0x0020000E, s); |
| 47 |
s = series.seriesNumber(); |
| 48 |
w.setString(0x00200011, s); |
| 49 |
} |
| 50 |
|
| 51 |
public void setGeneralEquipmentModule(DICOM.DICOMWrapper w, |
| 52 |
DICOM.Module.GeneralEquipmentModule eqpt) { |
| 53 |
String s = eqpt.manufacturer(); |
| 54 |
w.setString(0x00080070, s); |
| 55 |
} |
| 56 |
|
| 57 |
public void setSOPCommonModule(DICOM.DICOMWrapper w, |
| 58 |
DICOM.Module.SOPCommonModule c) { |
| 59 |
String s = c.sopClassUID(); |
| 60 |
w.setString(0x00080016, s); |
| 61 |
s = c.sopInstanceUID(); |
| 62 |
w.setString(0x00080018, s); |
| 63 |
} |
| 64 |
public void setSRDocumentSeriesModule(DICOM.DICOMWrapper w, |
| 65 |
DICOM.Module.GeneralSeriesModule series) { |
| 66 |
String s = series.modality(); |
| 67 |
w.setString(0x00080060, s); |
| 68 |
s = series.seriesUID(); |
| 69 |
w.setString(0x0020000E, s); |
| 70 |
s = series.seriesNumber(); |
| 71 |
w.setString(0x00200011, s); |
| 72 |
} |
| 73 |
public void setSRDocumentSeriesModule(DICOM.DICOMWrapper w, |
| 74 |
DICOM.Module.SRDocumentSeriesModule series) { |
| 75 |
String s = series.modality(); |
| 76 |
w.setString(0x00080060, s); |
| 77 |
s = series.seriesUID(); |
| 78 |
w.setString(0x0020000E, s); |
| 79 |
s = series.seriesNumber(); |
| 80 |
w.setString(0x00200011, s); |
| 81 |
} |
| 82 |
|
| 83 |
public void setSRDocumentGeneralModule(DICOM.SR.StructuredReport w, |
| 84 |
DICOM.Module.SRDocumentGeneralModule m) { |
| 85 |
String s = m.instanceNumber(); |
| 86 |
w.setString(0x00200013, s); |
| 87 |
s = m.completionFlag(); |
| 88 |
w.setString(0x0040a491, s); |
| 89 |
s = m.verificationFlag(); |
| 90 |
w.setString(0x0040a493, s); |
| 91 |
s = m.contentDate(); |
| 92 |
w.setString(0x00080023, s); |
| 93 |
s = m.contentTime(); |
| 94 |
w.setString(0x00080033, s); |
| 95 |
|
| 96 |
s = m.verificationFlag(); |
| 97 |
if (s.equals("VERIFIED")) { |
| 98 |
w.addSequence(0x0040a073); |
| 99 |
DICOM.DICOMWrapper x = new DICOM.DICOMWrapper(); |
| 100 |
s = m.verifyingObserverName(); |
| 101 |
x.setString(0x0040a075, s); |
| 102 |
s = m.verifyingOrganization(); |
| 103 |
x.setString(0x0040a027, s); |
| 104 |
s = m.verificationDateTime(); |
| 105 |
x.setString(0x0040a030, s); |
| 106 |
s = m.verifyingObserverCode(); |
| 107 |
x.setString(0x0040a088, 0x00080100, s, 1); |
| 108 |
s = m.verifyingObserverDesignator(); |
| 109 |
x.setString(0x0040a088, 0x00080102, s, 1); |
| 110 |
s = m.verifyingObserverMeaning(); |
| 111 |
x.setString(0x0040a088, 0x00080104, s, 1); |
| 112 |
|
| 113 |
w.addToSequence(0x0040a073, 0, x); |
| 114 |
} |
| 115 |
} |
| 116 |
|
| 117 |
public void setSRDocumentContentModule(DICOM.SR.StructuredReport w, |
| 118 |
DICOM.Module.SRDocumentContentModule m) { |
| 119 |
w.setString(0x0040a040, "CONTAINER"); |
| 120 |
|
| 121 |
DICOM.Code.CodeItem docTitle = m.documentTitle(); |
| 122 |
|
| 123 |
w.setString(0x0040a043, 0x00080100, docTitle.codeValue(), 1); |
| 124 |
w.setString(0x0040a043, 0x00080102, docTitle.codeDesignator(), 1); |
| 125 |
w.setString(0x0040a043, 0x00080104, docTitle.codeMeaning(), 1); |
| 126 |
|
| 127 |
w.addSequence(0x0040a730); |
| 128 |
java.util.Vector v = m.contentItemVector(); |
| 129 |
int i = 0; |
| 130 |
for (i = 0; i < v.size(); i++) { |
| 131 |
DICOM.SR.ContentItem item = (DICOM.SR.ContentItem)v.elementAt(i); |
| 132 |
w.addToSequence(0x0040a730, 0, item.wrapper()); |
| 133 |
} |
| 134 |
} |
| 135 |
|
| 136 |
public DICOM.Module.PatientModule |
| 137 |
getPatientModule(DICOM.DICOMWrapper w) { |
| 138 |
String name = w.getString(0x00100010); |
| 139 |
String id = w.getString(0x00100020); |
| 140 |
String dob = w.getString(0x00100030); |
| 141 |
String sex = w.getString(0x00100040); |
| 142 |
|
| 143 |
DICOM.Module.PatientModule m = new |
| 144 |
DICOM.Module.PatientModule(name, id, dob, sex); |
| 145 |
return m; |
| 146 |
} |
| 147 |
|
| 148 |
public DICOM.Module.GeneralStudyModule |
| 149 |
getGeneralStudyModule(DICOM.DICOMWrapper w) { |
| 150 |
String studyUID = w.getString(0x0020000D); |
| 151 |
String studyDate = w.getString(0x00080020); |
| 152 |
String studyTime = w.getString(0x00080030); |
| 153 |
String referringPhysician = w.getString(0x00080090); |
| 154 |
String studyID = w.getString(0x00200010); |
| 155 |
String accessionNumber = w.getString(0x00080050); |
| 156 |
|
| 157 |
DICOM.Module.GeneralStudyModule m = new DICOM.Module.GeneralStudyModule( |
| 158 |
studyUID, studyDate, studyTime, referringPhysician, |
| 159 |
studyID, accessionNumber); |
| 160 |
return m; |
| 161 |
} |
| 162 |
|
| 163 |
public DICOM.Module.GeneralEquipmentModule |
| 164 |
getGeneralEquipmentModule(DICOM.DICOMWrapper w) { |
| 165 |
String manufacturer = w.getString(0x00080070); |
| 166 |
|
| 167 |
DICOM.Module.GeneralEquipmentModule m |
| 168 |
= new DICOM.Module.GeneralEquipmentModule(manufacturer); |
| 169 |
|
| 170 |
return m; |
| 171 |
} |
| 172 |
|
| 173 |
public DICOM.Module.SOPCommonModule |
| 174 |
getSOPCommonModule(DICOM.DICOMWrapper w) { |
| 175 |
String classUID = w.getString(0x00080016); |
| 176 |
String instanceUID = w.getString(0x00080018); |
| 177 |
DICOM.Module.SOPCommonModule m = |
| 178 |
new DICOM.Module.SOPCommonModule(classUID, instanceUID); |
| 179 |
return m; |
| 180 |
} |
| 181 |
public DICOM.Module.GeneralSeriesModule |
| 182 |
getGeneralSeriesModule(DICOM.DICOMWrapper w) { |
| 183 |
String modality = w.getString(0x00080060); |
| 184 |
String seriesUID = w.getString(0x0020000E); |
| 185 |
String seriesNumber = w.getString(0x00200011); |
| 186 |
|
| 187 |
DICOM.Module.GeneralSeriesModule m = |
| 188 |
new DICOM.Module.GeneralSeriesModule(modality, seriesUID, seriesNumber); |
| 189 |
|
| 190 |
return m; |
| 191 |
} |
| 192 |
public DICOM.Module.SRDocumentSeriesModule |
| 193 |
getSRDocumentSeriesModule(DICOM.DICOMWrapper w) { |
| 194 |
String modality = w.getString(0x00080060); |
| 195 |
String seriesUID = w.getString(0x0020000E); |
| 196 |
String seriesNumber = w.getString(0x00200011); |
| 197 |
|
| 198 |
DICOM.Module.SRDocumentSeriesModule m = |
| 199 |
new DICOM.Module.SRDocumentSeriesModule(modality, seriesUID, seriesNumber); |
| 200 |
|
| 201 |
return m; |
| 202 |
} |
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
public int inflateStructuredReport(DICOM.DICOMWrapper report, |
| 207 |
DICOM.DICOMWrapper w) { |
| 208 |
DICOM.Module.SOPCommonModule m = getSOPCommonModule(w); |
| 209 |
setSOPCommonModule(report, m); |
| 210 |
|
| 211 |
DICOM.Module.PatientModule p = getPatientModule(w); |
| 212 |
setPatientModule(report, p); |
| 213 |
|
| 214 |
DICOM.Module.GeneralStudyModule s = getGeneralStudyModule(w); |
| 215 |
setGeneralStudyModule(report, s); |
| 216 |
|
| 217 |
DICOM.Module.GeneralEquipmentModule e = getGeneralEquipmentModule(w); |
| 218 |
setGeneralEquipmentModule(report, e); |
| 219 |
|
| 220 |
if (isStructuredReport(w)) { |
| 221 |
} else { |
| 222 |
DICOM.Module.GeneralSeriesModule series = getGeneralSeriesModule(w); |
| 223 |
setSRDocumentSeriesModule(report, series); |
| 224 |
} |
| 225 |
return 0; |
| 226 |
} |
| 227 |
|
| 228 |
private boolean isStructuredReport(DICOM.DICOMWrapper w) { |
| 229 |
String sopClass = w.getString(0x00080016); |
| 230 |
if (sopClass.equals("1.2.840.10008.5.1.4.1.1.88.11")) |
| 231 |
return true; |
| 232 |
if (sopClass.equals("1.2.840.10008.5.1.4.1.1.88.22")) |
| 233 |
return true; |
| 234 |
if (sopClass.equals("1.2.840.10008.5.1.4.1.1.88.33")) |
| 235 |
return true; |
| 236 |
|
| 237 |
return false; |
| 238 |
} |
| 239 |
} |