Produced by Araxis Merge on 12/5/2017 12:06:39 PM Central Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\DicomCodecImpl\main\src\java\gov\va\med\imaging\dicom | DataSet.java | Mon Dec 4 21:34:32 2017 UTC |
| 2 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\DicomCodecImpl\main\src\java\gov\va\med\imaging\dicom | DataSet.java | Mon Dec 4 21:59:19 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 1354 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | /** | |
| 2 | * | |
| 3 | */ | |
| 4 | package go v.va.med.i maging.dic om; | |
| 5 | ||
| 6 | ||
| 7 | import gov .va.med.im aging.dico m.dataelem ent.Encaps ulatedPixe lDataEleme nt; | |
| 8 | import gov .va.med.im aging.dico m.dataelem ent.Native PixelDataE lement; | |
| 9 | import gov .va.med.im aging.dico m.exceptio ns.DicomFo rmatExcept ion; | |
| 10 | import gov .va.med.im aging.dico m.exceptio ns.Invalid VRExceptio n; | |
| 11 | import gov .va.med.im aging.dico m.exceptio ns.Invalid VRModeExce ption; | |
| 12 | import gov .va.med.im aging.dico m.exceptio ns.RawPixe lInterpret ationValue sNotSetExc eption; | |
| 13 | import gov .va.med.im aging.dico m.exceptio ns.ValueRe presentati onInterpre tationExce ption; | |
| 14 | ||
| 15 | import jav a.awt.imag e.Buffered Image; | |
| 16 | import jav a.io.IOExc eption; | |
| 17 | import jav a.io.Seria lizable; | |
| 18 | import jav a.util.Col lection; | |
| 19 | import jav a.util.Com parator; | |
| 20 | import jav a.util.Dat e; | |
| 21 | import jav a.util.Ite rator; | |
| 22 | import jav a.util.Lis t; | |
| 23 | import jav a.util.Sor tedMap; | |
| 24 | import jav a.util.Sor tedSet; | |
| 25 | import jav a.util.Tre eMap; | |
| 26 | import jav a.util.Tre eSet; | |
| 27 | import org .apache.lo gging.log4 j.LogManag er; | |
| 28 | import org .apache.lo gging.log4 j.Logger; | |
| 29 | ||
| 30 | /** | |
| 31 | * This cl ass is a S et of all of the Dat aElement i nstances i n a single DICOM Par t 10 file. | |
| 32 | * The Dat aElement i nstances a re stored in a Map, using the DataElemen tTag (grou p and elem ent number s) as | |
| 33 | * the key to allow rapid acce ss by that attribute . Logical ly (withou t regard t o access t imes) this | |
| 34 | * is a Se t of DataE lement ins tances. | |
| 35 | * | |
| 36 | * From th e spec: | |
| 37 | * A Data Element is uniquely identified by a Data Element T ag. | |
| 38 | * The Dat a Elements in a Data Set shall be ordere d by incre asing Data Element T ag Number and shall | |
| 39 | * occur a t most onc e in a Dat a Set. | |
| 40 | * | |
| 41 | * @author
|
|
| 42 | * | |
| 43 | */ | |
| 44 | public cla ss DataSet | |
| 45 | implements Serializa ble, Sorte dSet<DataE lement<?>> | |
| 46 | { | |
| 47 | pr ivate stat ic final l ong serial VersionUID = 1L; | |
| 48 | pr ivate Sort edMap<Data ElementTag , DataElem ent<?>> wr appedMap = new TreeM ap<DataEle mentTag, D ataElement <?>>(); | |
| 49 | pr ivate fina l Transfer SyntaxUid transferSy ntax; | |
| 50 | pr ivate fina l Logger l ogger = Lo gManager.g etLogger(t his.getCla ss().getNa me()); | |
| 51 | ||
| 52 | pu blic DataS et(Transfe rSyntaxUid transferS yntax) | |
| 53 | { | |
| 54 | this .transferS yntax = tr ansferSynt ax; | |
| 55 | } | |
| 56 | ||
| 57 | /* * | |
| 58 | * @re turn the t ransferSyn tax | |
| 59 | */ | |
| 60 | public TransferS yntaxUid g etTransfer Syntax() | |
| 61 | { | |
| 62 | re turn trans ferSyntax; | |
| 63 | } | |
| 64 | ||
| 65 | // === ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== | |
| 66 | // | |
| 67 | // === ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== | |
| 68 | /* * | |
| 69 | * | |
| 70 | * @param el ementTag | |
| 71 | * @return | |
| 72 | * / | |
| 73 | pu blic DataE lement<?> get(String elementTa g) | |
| 74 | { | |
| 75 | retu rn wrapped Map.get(ne w DataElem entTag(ele mentTag)); | |
| 76 | } | |
| 77 | ||
| 78 | /* * | |
| 79 | * | |
| 80 | * @param gr oupNumber | |
| 81 | * @param el ementNumbe r | |
| 82 | * @return | |
| 83 | * / | |
| 84 | pu blic DataE lement<?> get(int gr oupNumber, int eleme ntNumber) | |
| 85 | { | |
| 86 | retu rn wrapped Map.get(ne w DataElem entTag(gro upNumber, elementNum ber)); | |
| 87 | } | |
| 88 | ||
| 89 | pu blic DataE lement<?> get(DataEl ementTag d ataElement Tag) | |
| 90 | { | |
| 91 | retu rn wrapped Map.get(da taElementT ag); | |
| 92 | } | |
| 93 | ||
| 94 | // ========= ========== ========== ========== ========== ========== ========== ========== === | |
| 95 | // Set imple mentation | |
| 96 | // ========= ========== ========== ========== ========== ========== ========== ========== === | |
| 97 | /* * | |
| 98 | * @se e java.uti l.Set#add( java.lang. Object) | |
| 99 | */ | |
| 100 | @Overr ide | |
| 101 | public boolean a dd(DataEle ment<?> da taElement) | |
| 102 | { | |
| 103 | if ( wrappedM ap.get(dat aElement.g etDataElem entTag()) != null ) | |
| 104 | retu rn false; | |
| 105 | ||
| 106 | wr appedMap.p ut(dataEle ment.getDa taElementT ag(), data Element); | |
| 107 | re turn true; | |
| 108 | } | |
| 109 | ||
| 110 | /* * | |
| 111 | * @se e java.uti l.Set#addA ll(java.ut il.Collect ion) | |
| 112 | */ | |
| 113 | @Overr ide | |
| 114 | public boolean a ddAll(Coll ection<? e xtends Dat aElement<? >> dataEle ments) | |
| 115 | { | |
| 116 | bo olean this SetChanged = false; | |
| 117 | fo r(DataElem ent<?> dat aElement : dataEleme nts) | |
| 118 | this SetChanged |= add(da taElement) ; // if any elemen t was adde d then the set was c hanged | |
| 119 | ||
| 120 | return t hisSetChan ged; | |
| 121 | } | |
| 122 | ||
| 123 | /* * | |
| 124 | * @se e java.uti l.Set#cont ains(java. lang.Objec t) | |
| 125 | */ | |
| 126 | @Overr ide | |
| 127 | public boolean c ontains(Ob ject o) | |
| 128 | { | |
| 129 | if (o instanc eof DataEl ement<?>) | |
| 130 | retu rn wrapped Map.get( ( (DataEleme nt<?>)o).g etDataElem entTag() ) != null; | |
| 131 | ||
| 132 | return f alse; | |
| 133 | } | |
| 134 | ||
| 135 | /* * | |
| 136 | * @se e java.uti l.Set#cont ainsAll(ja va.util.Co llection) | |
| 137 | */ | |
| 138 | @Overr ide | |
| 139 | public boolean c ontainsAll (Collectio n<?> c) | |
| 140 | { | |
| 141 | fo r(Object o : c) | |
| 142 | if(! contains( o)) | |
| 143 | return false; | |
| 144 | re turn true; | |
| 145 | } | |
| 146 | ||
| 147 | /* * | |
| 148 | * @se e java.uti l.Set#iter ator() | |
| 149 | */ | |
| 150 | @Overr ide | |
| 151 | public Iterator< DataElemen t<?>> iter ator() | |
| 152 | { | |
| 153 | return w rappedMap. values().i terator(); | |
| 154 | } | |
| 155 | ||
| 156 | /* * | |
| 157 | * @se e java.uti l.Set#remo veAll(java .util.Coll ection) | |
| 158 | */ | |
| 159 | @Overr ide | |
| 160 | public boolean r emoveAll(C ollection< ?> c) | |
| 161 | { | |
| 162 | bo olean this SetChanged = false; | |
| 163 | ||
| 164 | fo r(Object o : c) | |
| 165 | if(o instanceo f DataElem ent) | |
| 166 | if( wr appedMap.v alues().co ntains(o) ) | |
| 167 | thisSetC hanged |= (wrappedMa p.remove( ((DataElem ent<?>)o). getDataEle mentTag() ) != null) ; | |
| 168 | ||
| 169 | return t hisSetChan ged; | |
| 170 | } | |
| 171 | ||
| 172 | /* * | |
| 173 | * @se e java.uti l.Set#reta inAll(java .util.Coll ection) | |
| 174 | */ | |
| 175 | @Overr ide | |
| 176 | public boolean r etainAll(C ollection< ?> c) | |
| 177 | { | |
| 178 | bo olean this SetChanged = false; | |
| 179 | ||
| 180 | fo r(DataElem ent<?> dat aElement : this) | |
| 181 | if( ! c.contai ns(dataEle ment) ) | |
| 182 | { | |
| 183 | remove (dataEleme nt); | |
| 184 | thisSe tChanged = true; | |
| 185 | } | |
| 186 | ||
| 187 | re turn thisS etChanged; | |
| 188 | } | |
| 189 | ||
| 190 | /* * | |
| 191 | * @se e java.uti l.Set#toAr ray() | |
| 192 | */ | |
| 193 | @Overr ide | |
| 194 | public Object[] toArray() | |
| 195 | { | |
| 196 | re turn wrapp edMap.valu es().toArr ay(); | |
| 197 | } | |
| 198 | ||
| 199 | /* * | |
| 200 | * @se e java.uti l.Set#toAr ray(T[]) | |
| 201 | */ | |
| 202 | @Overr ide | |
| 203 | public <T> T[] t oArray(T[] a) | |
| 204 | { | |
| 205 | re turn wrapp edMap.valu es().toArr ay(a); | |
| 206 | } | |
| 207 | ||
| 208 | /* * | |
| 209 | * @se e java.uti l.Set#clea r() | |
| 210 | */ | |
| 211 | @Overr ide | |
| 212 | public void clea r() | |
| 213 | { | |
| 214 | wr appedMap.c lear(); | |
| 215 | } | |
| 216 | ||
| 217 | /* * | |
| 218 | * @se e java.uti l.Set#isEm pty() | |
| 219 | */ | |
| 220 | @Overr ide | |
| 221 | public boolean i sEmpty() | |
| 222 | { | |
| 223 | return w rappedMap. isEmpty(); | |
| 224 | } | |
| 225 | ||
| 226 | /* * | |
| 227 | * @se e java.uti l.Set#remo ve(java.la ng.Object) | |
| 228 | */ | |
| 229 | @Overr ide | |
| 230 | public boolean r emove(Obje ct o) | |
| 231 | { | |
| 232 | if (o instanc eof DataEl ement<?>) | |
| 233 | retu rn wrapped Map.remove (((DataEle ment<?>)o) .getDataEl ementTag() ) != null; | |
| 234 | ||
| 235 | re turn false ; | |
| 236 | } | |
| 237 | ||
| 238 | /* * | |
| 239 | * @se e java.uti l.Set#size () | |
| 240 | */ | |
| 241 | @Overr ide | |
| 242 | public int size( ) | |
| 243 | { | |
| 244 | return w rappedMap. values().s ize(); | |
| 245 | } | |
| 246 | ||
| 247 | /* * | |
| 248 | * @se e java.uti l.SortedSe t#comparat or() | |
| 249 | * @re turn null, because t his always uses the natural or dering of DataElemen t | |
| 250 | */ | |
| 251 | @Overr ide | |
| 252 | public Comparato r<? super DataElemen t<?>> comp arator() | |
| 253 | { | |
| 254 | return n ull; | |
| 255 | } | |
| 256 | ||
| 257 | /* * | |
| 258 | * @se e java.uti l.SortedSe t#first() | |
| 259 | */ | |
| 260 | @Overr ide | |
| 261 | public DataEleme nt<?> firs t() | |
| 262 | { | |
| 263 | re turn wrapp edMap.get( wrappedMap .firstKey( )); | |
| 264 | } | |
| 265 | ||
| 266 | /* * | |
| 267 | * @se e java.uti l.SortedSe t#headSet( java.lang. Object) | |
| 268 | */ | |
| 269 | @Overr ide | |
| 270 | public SortedSet <DataEleme nt<?>> hea dSet(DataE lement<?> toElement) | |
| 271 | { | |
| 272 | re turn new T reeSet<Dat aElement<? >>( wrappe dMap.headM ap(toEleme nt.getData ElementTag ()).values () ); | |
| 273 | } | |
| 274 | ||
| 275 | /* * | |
| 276 | * @se e java.uti l.SortedSe t#last() | |
| 277 | */ | |
| 278 | @Overr ide | |
| 279 | public DataEleme nt<?> last () | |
| 280 | { | |
| 281 | re turn wrapp edMap.get( wrappedMap .lastKey() ); | |
| 282 | } | |
| 283 | ||
| 284 | /* * | |
| 285 | * @se e java.uti l.SortedSe t#subSet(j ava.lang.O bject, jav a.lang.Obj ect) | |
| 286 | */ | |
| 287 | @Overr ide | |
| 288 | public SortedSet <DataEleme nt<?>> sub Set(DataEl ement<?> f romElement , DataElem ent<?> toE lement) | |
| 289 | { | |
| 290 | re turn new T reeSet<Dat aElement<? >>( wrappe dMap.subMa p(fromElem ent.getDat aElementTa g(), toEle ment.getDa taElementT ag()).valu es() ); | |
| 291 | } | |
| 292 | ||
| 293 | /* * | |
| 294 | * @se e java.uti l.SortedSe t#tailSet( java.lang. Object) | |
| 295 | */ | |
| 296 | @Overr ide | |
| 297 | public SortedSet <DataEleme nt<?>> tai lSet(DataE lement<?> fromElemen t) | |
| 298 | { | |
| 299 | re turn new T reeSet<Dat aElement<? >>( wrappe dMap.tailM ap(fromEle ment.getDa taElementT ag()).valu es() ); | |
| 300 | } | |
| 301 | ||
| 302 | /** | |
| 303 | * Get an iterat or over al l of the e lements in this with the speci fied group number | |
| 304 | * @pa ram groupN umber | |
| 305 | */ | |
| 306 | pu blic Itera tor<DataEl ement<?>> iterator(i nt groupNu mber) | |
| 307 | { | |
| 308 | retu rn new Gro upIterator (groupNumb er); | |
| 309 | } | |
| 310 | ||
| 311 | cl ass GroupI terator | |
| 312 | im plements I terator<Da taElement< ?>> | |
| 313 | { | |
| 314 | fina l private int groupN umber; | |
| 315 | priv ate DataEl ement<?> n extDataEle ment = nul l; | |
| 316 | priv ate final Iterator<D ataElement <?>> wrapp edIterator ; | |
| 317 | ||
| 318 | Grou pIterator( int groupN umber) | |
| 319 | { | |
| 320 | this.g roupNumber = groupNu mber; | |
| 321 | wrappe dIterator = iterator (); | |
| 322 | } | |
| 323 | ||
| 324 | @Ove rride | |
| 325 | pu blic boole an hasNext () | |
| 326 | { | |
| 327 | positi on(); | |
| 328 | return nextDataE lement != null; | |
| 329 | } | |
| 330 | ||
| 331 | @Ove rride | |
| 332 | pu blic DataE lement<?> next() | |
| 333 | { | |
| 334 | positi on(); | |
| 335 | if(nex tDataEleme nt != null ) | |
| 336 | { | |
| 337 | DataElem ent<?> tmp = nextDat aElement; | |
| 338 | nextData Element = null; | |
| 339 | return t mp; | |
| 340 | } | |
| 341 | return n ull; | |
| 342 | } | |
| 343 | ||
| 344 | priv ate synchr onized voi d position () | |
| 345 | { | |
| 346 | whil e(wrappedI terator != null && w rappedIter ator.hasNe xt() && ne xtDataElem ent == nul l) | |
| 347 | { | |
| 348 | DataEl ement<?> n extTmp = w rappedIter ator.next( ); | |
| 349 | if(nex tTmp.getDa taElementT ag().getGr oup() == g roupNumber ) | |
| 350 | nextData Element = nextTmp; | |
| 351 | } | |
| 352 | } | |
| 353 | ||
| 354 | @Ove rride | |
| 355 | pu blic void remove() | |
| 356 | { | |
| 357 | } | |
| 358 | }; | |
| 359 | ||
| 360 | pu blic Colle ction<Data Element<?> > subset(i nt groupNu mber) | |
| 361 | { | |
| 362 | retu rn | |
| 363 | this.w rappedMap. subMap(new DataEleme ntTag(grou pNumber, 0 x0000), ne w DataElem entTag(gro upNumber, 0xFFFF)).v alues(); | |
| 364 | } | |
| 365 | ||
| 366 | // ========= ========== ========== ========== ========== ========== ========== ========== === | |
| 367 | // Convenien ce Methods , to get s ome well-k nown DICOM tag value s | |
| 368 | // ========= ========== ========== ========== ========== ========== ========== ========== === | |
| 369 | pu blic DataE lement<?> getCommand GroupLengt h() | |
| 370 | { | |
| 371 | retu rn get( 0x 0000, 0x00 00 ); | |
| 372 | } | |
| 373 | ||
| 374 | // ========= ========== ========== ========== ========== ========== ========== ========== ========== ======= | |
| 375 | // DICOM Hea der Elemen ts | |
| 376 | // ========= ========== ========== ========== ========== ========== ========== ========== ========== ======= | |
| 377 | /* * | |
| 378 | * Number of bytes fol lowing thi s File Met a Element (end of th e Value fi eld) up to and inclu ding the l ast | |
| 379 | * File Meta Element o f the Grou p 2 File M eta Inform ation | |
| 380 | * | |
| 381 | * @return | |
| 382 | * / | |
| 383 | pu blic DataE lement<?> getGroupLe ngth() | |
| 384 | { | |
| 385 | retu rn get(0x0 002,0x0000 ); | |
| 386 | } | |
| 387 | ||
| 388 | ||
| 389 | /* * | |
| 390 | * This is a two byte field where eac h bit iden tifies a v ersion of this File Meta Infor mation hea der. | |
| 391 | * In versio n 1 the fi rst byte v alue is 00 H and the second val ue byte va lue is 01H . | |
| 392 | * Implement ations rea ding Files with Meta Informati on where t his attrib ute has bi t 0 (lsb) of the sec ond byte | |
| 393 | * set to 1 may interp ret the Fi le Meta In formation as specifi ed in this version o f PS 3.10. All other bits | |
| 394 | * shall not be checke d. | |
| 395 | * Note: A b it field w here each bit identi fies a ver sion, allo ws explici t indicati on of the support of | |
| 396 | * multiple previous v ersions. F uture vers ions of th e File Met a Informat ion that c an be read by verson 1 | |
| 397 | * readers w ill have b it 0 of th e second b yte set to 1. | |
| 398 | * | |
| 399 | * @return | |
| 400 | * / | |
| 401 | pu blic DataE lement<?> getFileMet aInformati onVersion( ) | |
| 402 | { | |
| 403 | retu rn get(0x0 002,0x0001 ); | |
| 404 | } | |
| 405 | ||
| 406 | /* * | |
| 407 | * Uniquely identifies the SOP C lass assoc iated with the Data Set. | |
| 408 | * SOP Class UIDs allo wed for me dia storag e are spec ified in P S 3.4 of t he DICOM S tandard - Media Stor age | |
| 409 | * Applicati on Profile s. | |
| 410 | * | |
| 411 | * @return | |
| 412 | * / | |
| 413 | pu blic DataE lement<?> getMediaSt orageSOPCl assUID() | |
| 414 | { | |
| 415 | retu rn get(0x0 002,0x0002 ); | |
| 416 | } | |
| 417 | ||
| 418 | /* * | |
| 419 | * Uniquely identifies the SOP I nstance as sociated w ith the Da ta Set pla ced in the file and following the | |
| 420 | * File Meta Informati on. | |
| 421 | * | |
| 422 | * @return | |
| 423 | * / | |
| 424 | pu blic DataE lement<?> getMediaSt orageSOPIn stanceUID( ) | |
| 425 | { | |
| 426 | retu rn get(0x0 002,0x0003 ); | |
| 427 | } | |
| 428 | ||
| 429 | /* * | |
| 430 | * Uniquely identifies the Trans fer Syntax used to e ncode the following Data Set. This Trans fer Syntax does not | |
| 431 | * apply to the File M eta Inform ation. | |
| 432 | * Note: It is recomme nded to us e one of t he DICOM T ransfer Sy ntaxes sup porting ex plicit Val ue Represe ntation | |
| 433 | * encoding to facilit ate interp retation o f File Met a Element Values. JP IP Referen ced Pixel Data Trans fer | |
| 434 | * Syntaxes are not us ed. (See P S 3.5 of t he DICOM S tandard). | |
| 435 | * | |
| 436 | * @return | |
| 437 | * / | |
| 438 | pu blic DataE lement<?> getTransfe rSyntaxUID () | |
| 439 | { | |
| 440 | retu rn get(Dat aElementTa g.TRANSFER _SYNTAX_UI D_TAG); | |
| 441 | } | |
| 442 | ||
| 443 | /* * | |
| 444 | * Uniquely identifies the imple mentation which wrot e this fil e and its content. I t provides an unambi guous | |
| 445 | * identific ation of t he type of implement ation whic h last wro te the fil e in the e vent of in terchange problems. | |
| 446 | * It follow s the same policies as defined by PS 3.7 of the DI COM Standa rd (associ ation nego tiation). | |
| 447 | * | |
| 448 | * @return | |
| 449 | * / | |
| 450 | pu blic DataE lement<?> getImpleme ntationCla ssUID() | |
| 451 | { | |
| 452 | retu rn get(0x0 002,0x0012 ); | |
| 453 | } | |
| 454 | ||
| 455 | /* * | |
| 456 | * Identifie s a versio n for an I mplementat ion Class UID (0002, 0012) usin g up to 16 character s of the r epertoire | |
| 457 | * identifie d in Secti on 8.5. It follows t he same po licies as defined by PS 3.7 of the DICOM Standard (associati on | |
| 458 | * negotiati on). | |
| 459 | * | |
| 460 | * @return | |
| 461 | * / | |
| 462 | pu blic DataE lement<?> getImpleme ntationVer sionName() | |
| 463 | { | |
| 464 | retu rn get(0x0 002,0x0013 ); | |
| 465 | } | |
| 466 | ||
| 467 | /* * | |
| 468 | * The DICOM Applicati on Entity (AE) Title of the AE which wro te this fi le's conte nt (or las t updated it). | |
| 469 | * If used, it allows the tracin g of the s ource of e rrors in t he event o f media in terchange problems. | |
| 470 | * The polic ies associ ated with AE Titles are the sa me as thos e defined in PS 3.8 of the DIC OM Standar d. | |
| 471 | * | |
| 472 | * @return | |
| 473 | * / | |
| 474 | pu blic DataE lement<?> getSourceA pplication EntityTitl e() | |
| 475 | { | |
| 476 | retu rn get(0x0 002,0x0016 ); | |
| 477 | } | |
| 478 | ||
| 479 | /* * | |
| 480 | * The UID o f the crea tor of the private i nformation (0x0002,0 x0102) | |
| 481 | * | |
| 482 | * @return | |
| 483 | * / | |
| 484 | pu blic DataE lement<?> getPrivate Informatio nCreatorUI D() | |
| 485 | { | |
| 486 | retu rn get(0x0 002,0x0100 ); | |
| 487 | } | |
| 488 | ||
| 489 | /* * | |
| 490 | * Contains Private In formation placed in the File M eta Inform ation. | |
| 491 | * The creat or shall b e identifi ed in (000 2,0100). | |
| 492 | * Required if Private Informati on Creator UID (0002 ,0100) is present. | |
| 493 | * | |
| 494 | * @return | |
| 495 | * / | |
| 496 | pu blic DataE lement<?> getPrivate Informatio n() | |
| 497 | { | |
| 498 | retu rn get(0x0 002,0x0102 ); | |
| 499 | } | |
| 500 | ||
| 501 | // ========= ========== ========== ========== ========== ========== ========== ========== ========== ======= | |
| 502 | // | |
| 503 | // ========= ========== ========== ========== ========== ========== ========== ========== ========== ======= | |
| 504 | /* * | |
| 505 | * DICOM App lication E ntities (A Es) that e xtend or r eplace the default r epertoire | |
| 506 | * convey th is informa tion in th e Specific Character Set (0008 ,0005) Att ribute. | |
| 507 | * | |
| 508 | * @return | |
| 509 | * / | |
| 510 | pu blic DataE lement<?> getSpecifi cCharacter Set() | |
| 511 | { | |
| 512 | retu rn get( 0x 0008, 0x00 05 ); | |
| 513 | } | |
| 514 | ||
| 515 | // ========= ========== ========== ========== ========== ========== ========== ========== ========== ======= | |
| 516 | // Patient I nformation Group (0x 0010) | |
| 517 | // ========= ========== ========== ========== ========== ========== ========== ========== ========== ======= | |
| 518 | pu blic Strin g getPatie ntId() | |
| 519 | th rows Value Representa tionInterp retationEx ception | |
| 520 | { | |
| 521 | retu rn get( 0x 0010, 0x00 10 ).getVa lue().toSt ring(); | |
| 522 | } | |
| 523 | ||
| 524 | pu blic Strin g getPatie ntName() | |
| 525 | th rows Value Representa tionInterp retationEx ception | |
| 526 | { | |
| 527 | retu rn get( 0x 0010, 0x00 20 ).getVa lue().toSt ring(); | |
| 528 | } | |
| 529 | ||
| 530 | pu blic Date getPatient BirthDate( ) | |
| 531 | th rows Value Representa tionInterp retationEx ception | |
| 532 | { | |
| 533 | retu rn (Date)( get( 0x00 10, 0x0030 ).getValu e()); | |
| 534 | } | |
| 535 | ||
| 536 | pu blic Strin g getPatie ntSex() | |
| 537 | th rows Value Representa tionInterp retationEx ception | |
| 538 | { | |
| 539 | retu rn get( 0x 0010, 0x00 40 ).getVa lue().toSt ring(); | |
| 540 | } | |
| 541 | ||
| 542 | pu blic Strin g getPatie ntAge() | |
| 543 | th rows Value Representa tionInterp retationEx ception | |
| 544 | { | |
| 545 | retu rn get( 0x 0010, 0x10 10 ).getVa lue().toSt ring(); | |
| 546 | } | |
| 547 | ||
| 548 | // ========= ========== ========== ========== ========== ========== ========== ========== ========== ======= | |
| 549 | // Image Inf ormation G roup (0x00 28) | |
| 550 | // ========= ========== ========== ========== ========== ========== ========== ========== ========== ======= | |
| 551 | pu blic DataE lement<?> getSamples PerPixel() | |
| 552 | { | |
| 553 | retu rn get( Da taElementT ag.SAMPLES _PER_PIXEL ); | |
| 554 | } | |
| 555 | ||
| 556 | pu blic DataE lement<?> getPhotome tricInterp retation() | |
| 557 | { | |
| 558 | retu rn get( Da taElementT ag.PHOTOME TRIC_INTER PRETATION ); | |
| 559 | } | |
| 560 | ||
| 561 | pu blic int g etRows() | |
| 562 | th rows Value Representa tionInterp retationEx ception | |
| 563 | { | |
| 564 | retu rn getInte gerDataEle ment(DataE lementTag. ROWS); | |
| 565 | } | |
| 566 | ||
| 567 | pu blic int g etColumns( ) | |
| 568 | th rows Value Representa tionInterp retationEx ception | |
| 569 | { | |
| 570 | retu rn getInte gerDataEle ment(DataE lementTag. COLUMNS); | |
| 571 | } | |
| 572 | ||
| 573 | pu blic int g etBitsAllo cated() | |
| 574 | th rows Value Representa tionInterp retationEx ception | |
| 575 | { | |
| 576 | retu rn getInte gerDataEle ment(DataE lementTag. BITS_ALLOC ATED); | |
| 577 | } | |
| 578 | ||
| 579 | pu blic int g etBitsStor ed() | |
| 580 | th rows Value Representa tionInterp retationEx ception | |
| 581 | { | |
| 582 | retu rn getInte gerDataEle ment(DataE lementTag. BITS_STORE D); | |
| 583 | } | |
| 584 | ||
| 585 | pu blic int g etHighBit( ) | |
| 586 | th rows Value Representa tionInterp retationEx ception | |
| 587 | { | |
| 588 | retu rn getInte gerDataEle ment(DataE lementTag. HIGH_BIT); | |
| 589 | } | |
| 590 | ||
| 591 | pr ivate int getInteger DataElemen t(DataElem entTag dat aElementTa g) | |
| 592 | { | |
| 593 | try | |
| 594 | { | |
| 595 | Intege r[] value = (Integer [])( get( dataElemen tTag ).get Value() ); | |
| 596 | return value[0]. intValue() ; | |
| 597 | } | |
| 598 | catc h(ClassCas tException ccX) | |
| 599 | { | |
| 600 | logger .error("Va lue return ed from ge tting elem ent '" + d ataElement Tag + "' i s not of t he expecte d type" ); | |
| 601 | return 0; | |
| 602 | } | |
| 603 | catc h (ValueRe presentati onInterpre tationExce ption e) | |
| 604 | { | |
| 605 | logger .error("Ge tting elem ent '" + d ataElement Tag + "' r esulted in '" + e.ge tMessage() + "'." ); | |
| 606 | return 0; | |
| 607 | } | |
| 608 | ||
| 609 | } | |
| 610 | // ========= ========== ========== ========== ========== ========== ========== ========== ========== ======= | |
| 611 | // | |
| 612 | // ========= ========== ========== ========== ========== ========== ========== ========== ========== ======= | |
| 613 | pu blic boole an isEncap sulated() | |
| 614 | { | |
| 615 | retu rn getTran sferSyntax ().isEncap sulated(); | |
| 616 | } | |
| 617 | ||
| 618 | pu blic Buffe redImage g etImage(in t frame) | |
| 619 | th rows Dicom FormatExce ption, IOE xception, InvalidVRM odeExcepti on, Invali dVRExcepti on, RawPix elInterpre tationValu esNotSetEx ception | |
| 620 | { | |
| 621 | List <BufferedI mage> fram es = getIm ageFrames( ); | |
| 622 | ||
| 623 | retu rn frames == null ? null : fra mes.get(fr ame); | |
| 624 | } | |
| 625 | ||
| 626 | pu blic int g etFrameCou nt() | |
| 627 | th rows Dicom FormatExce ption, IOE xception, InvalidVRM odeExcepti on, Invali dVRExcepti on, RawPix elInterpre tationValu esNotSetEx ception | |
| 628 | { | |
| 629 | List <BufferedI mage> fram es = getIm ageFrames( ); | |
| 630 | retu rn frames == null ? 0 : frames .size(); | |
| 631 | } | |
| 632 | ||
| 633 | pu blic Buffe redImage g etFirstIma ge() | |
| 634 | th rows Dicom FormatExce ption, IOE xception, InvalidVRM odeExcepti on, Invali dVRExcepti on, RawPix elInterpre tationValu esNotSetEx ception | |
| 635 | { | |
| 636 | retu rn getImag e(0); | |
| 637 | } | |
| 638 | ||
| 639 | pu blic List< BufferedIm age> getIm ageFrames( ) | |
| 640 | th rows Dicom FormatExce ption, IOE xception, InvalidVRM odeExcepti on, Invali dVRExcepti on, RawPix elInterpre tationValu esNotSetEx ception | |
| 641 | { | |
| 642 | Data Element<?> imageElem ent = get( DataElemen tTag.PIXEL _DATA_TAG) ; | |
| 643 | ||
| 644 | if( this.trans ferSyntax. isEncapsul ated() && imageEleme nt != null && imageE lement ins tanceof En capsulated PixelDataE lement ) | |
| 645 | return ((Encapsu latedPixel DataElemen t)imageEle ment).getE ncapsulate dPixelData (); | |
| 646 | else if( image Element != null && i mageElemen t instance of NativeP ixelDataEl ement ) | |
| 647 | { | |
| 648 | Native PixelDataE lement nat ivePixelDa taElement = (NativeP ixelDataEl ement)imag eElement; | |
| 649 | int bi tsAllocate d = getBit sAllocated (); | |
| 650 | int bi tsStored = getBitsS tored(); | |
| 651 | int hi ghBit = ge tHighBit() ; | |
| 652 | int wi dth = getC olumns(); | |
| 653 | int he ight = get Rows(); | |
| 654 | native PixelDataE lement.set NativePixe lInterpret ationParam eters(bits Allocated, bitsStore d, highBit , width, h eight); | |
| 655 | return nativePix elDataElem ent.getNat ivePixelDa ta(); | |
| 656 | } | |
| 657 | ||
| 658 | retu rn null; | |
| 659 | } | |
| 660 | ||
| 661 | // ========= ========== ========== ========== ========== ========== ========== ========== ========== == | |
| 662 | // | |
| 663 | // ========= ========== ========== ========== ========== ========== ========== ========== ========== == | |
| 664 | pu blic DataE lement<?> getItem() | |
| 665 | { | |
| 666 | retu rn get( Da taElementT ag.SEQUENC E_ITEM_TAG ); | |
| 667 | } | |
| 668 | ||
| 669 | pu blic DataE lement<?> getItemDel imitationI tem() | |
| 670 | { | |
| 671 | retu rn get( Da taElementT ag.ITEM_DE LIMITATION _TAG ); | |
| 672 | } | |
| 673 | ||
| 674 | pu blic DataE lement<?> getSequenc eDelimitat ionItem() | |
| 675 | { | |
| 676 | retu rn get( Da taElementT ag.SEQUENC E_DELIMITA TION_TAG ) ; | |
| 677 | } | |
| 678 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.