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 | DataElementFactory.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 | DataElementFactory.java | Mon Dec 4 21:59:18 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 422 |
| Changed | 2 | 4 |
| 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 | * Package : MAG - Vi stA Imagin g | |
| 3 | * WARNING : Per VHA Directive 2004-038, this routi ne should not be mod ified. | |
| 4 | * Date Cr eated: Jul 18, 2008 | |
| 5 | * Site Na me: Washi ngton OI F ield Offic e, Silver Spring, MD | |
| 6 | * @author
|
|
| 7 | * @versio n 1.0 | |
| 8 | * | |
| 9 | * ------- ---------- ---------- ---------- ---------- ---------- ------- | |
| 10 | * Propert y of the U S Governme nt. | |
| 11 | * No perm ission to copy or re distribute this soft ware is gi ven. | |
| 12 | * Use of unreleased versions of this so ftware req uires the user | |
| 13 | * to exec ute a writ ten test a greement w ith the Vi stA Imagin g | |
| 14 | * Develop ment Offic e of the D epartment of Veteran s Affairs, | |
| 15 | * telepho ne (301) 7 34-0100. | |
| 16 | * | |
| 17 | * The Foo d and Drug Administr ation clas sifies thi s software as | |
| 18 | * a Class II medica l device. As such, it may not be change d | |
| 19 | * in any way. Modi fications to this so ftware may result in an | |
| 20 | * adulter ated medic al device under 21CF R820, the use of whi ch | |
| 21 | * is cons idered to be a viola tion of US Federal S tatutes. | |
| 22 | * ------- ---------- ---------- ---------- ---------- ---------- ------- | |
| 23 | */ | |
| 24 | package go v.va.med.i maging.dic om; | |
| 25 | ||
| 26 | import gov .va.med.im aging.dico m.dictiona ry.DicomDi ctionary; | |
| 27 | import gov .va.med.im aging.dico m.dictiona ry.DicomDi ctionaryEn try; | |
| 28 | import gov .va.med.im aging.dico m.exceptio ns.Invalid VRModeExce ption; | |
| 29 | import gov .va.med.im aging.dico m.exceptio ns.Unspeci fiedVRWith ExplicitVR Exception; | |
| 30 | ||
| 31 | import jav a.lang.ref lect.Const ructor; | |
| 32 | import jav a.lang.ref lect.Invoc ationTarge tException ; | |
| 33 | import org .apache.lo gging.log4 j.LogManag er; | |
| 34 | import org .apache.lo gging.log4 j.Logger; | |
| 35 | ||
| 36 | /** | |
| 37 | * @author
|
|
| 38 | * | |
| 39 | */ | |
| 40 | public cla ss DataEle mentFactor y | |
| 41 | { | |
| 42 | pr ivate fina l DicomDic tionary di ctionary; | |
| 43 | pr ivate fina l Transfer SyntaxUid transferSy ntaxUid; | |
| 44 | pr ivate fina l boolean createUnkn ownDataEle mentTag; | |
| 45 | pr ivate Logg er logger = LogManag er.getLogg er(this.ge tClass().g etName()); | |
| 46 | ||
| 47 | pr ivate stat ic DataEle mentFactor y defaultH eaderEleme ntFactory; | |
| 48 | ||
| 49 | /* * | |
| 50 | * A special element f actory tha t reads th e DICOM he ader eleme nts. | |
| 51 | * ===> Expl icit VR Li ttle Endia n <=== | |
| 52 | * | |
| 53 | * See DICOM spec, sec tion 7.3 f or details . | |
| 54 | * | |
| 55 | * ..., the File Meta Informatio n shall be encoded | |
| 56 | * using the Explicit VR Little Endian Tra nsfer Synt ax (UID=1. 2.840.1000 8.1.2.1) a s defined in DICOM P S 3.5. | |
| 57 | * Values of each File Meta Elem ent shall be padded when neces sary to ac hieve an e ven length as specif ied in | |
| 58 | * PS 3.5 by their cor responding Value Rep resentatio n. | |
| 59 | * For compa tibility w ith future versions of this St andard, an y Tag (000 2,xxxx) no t defined in Table 7 .1-1 | |
| 60 | * shall be ignored. | |
| 61 | * | |
| 62 | * @return | |
| 63 | * / | |
| 64 | pu blic stati c synchron ized DataE lementFact ory getDef aultHeader ElementFac tory() | |
| 65 | { | |
| 66 | if(d efaultHead erElementF actory == null) | |
| 67 | defaul tHeaderEle mentFactor y = new Da taElementF actory(Dic omDictiona ry.getDefa ultHeaderD ictionary( ), Transfe rSyntaxUid .RAW_EXPLI CIT_VR_LIT TLEENDIAN, false); | |
| 68 | ||
| 69 | retu rn default HeaderElem entFactory ; | |
| 70 | } | |
| 71 | ||
| 72 | /* * | |
| 73 | * | |
| 74 | * @param tr ansferSynt ax | |
| 75 | * @return | |
| 76 | * / | |
| 77 | pu blic stati c DataElem entFactory getDataEl ementFacto ry(Transfe rSyntaxUid transferS yntax) | |
| 78 | { | |
| 79 | retu rn new Dat aElementFa ctory( Dic omDictiona ry.getDefa ult(), tra nsferSynta x, true ); | |
| 80 | } | |
| 81 | ||
| 82 | /* * | |
| 83 | * | |
| 84 | * @param di ctionary | |
| 85 | * / | |
| 86 | pu blic DataE lementFact ory( | |
| 87 | DicomD ictionary dictionary , | |
| 88 | Transf erSyntaxUi d transfer SyntaxUid, | |
| 89 | boolea n createUn knownDataE lementTag) | |
| 90 | { | |
| 91 | this .dictionar y = dictio nary; | |
| 92 | this .transferS yntaxUid = transferS yntaxUid; | |
| 93 | this .createUnk nownDataEl ementTag = createUnk nownDataEl ementTag; | |
| 94 | } | |
| 95 | ||
| 96 | /* * | |
| 97 | * @re turn the d ictionary | |
| 98 | */ | |
| 99 | public DicomDict ionary get Dictionary () | |
| 100 | { | |
| 101 | re turn dicti onary; | |
| 102 | } | |
| 103 | ||
| 104 | /** | |
| 105 | * | |
| 106 | * @re turn | |
| 107 | */ | |
| 108 | public TransferS yntaxUid g etTransfer SyntaxUid( ) | |
| 109 | { | |
| 110 | re turn this. transferSy ntaxUid; | |
| 111 | } | |
| 112 | ||
| 113 | /* * | |
| 114 | * @re turn the e xplicitVR | |
| 115 | */ | |
| 116 | public boolean i sExplicitV R() | |
| 117 | { | |
| 118 | re turn this. transferSy ntaxUid.is ExplicitVR (); | |
| 119 | } | |
| 120 | ||
| 121 | /* * | |
| 122 | * @re turn the l ittleEndia n | |
| 123 | */ | |
| 124 | public boolean i sLittleEnd ian() | |
| 125 | { | |
| 126 | re turn this. transferSy ntaxUid.is LittleEndi an(); | |
| 127 | } | |
| 128 | ||
| 129 | /* * | |
| 130 | * @re turn the c reateUnkno wnDataElem entTag | |
| 131 | */ | |
| 132 | public boolean i sCreateUnk nownDataEl ementTag() | |
| 133 | { | |
| 134 | re turn creat eUnknownDa taElementT ag; | |
| 135 | } | |
| 136 | ||
| 137 | /* * | |
| 138 | * Create a DataElemen t of any V R except S Q. | |
| 139 | * | |
| 140 | * @param da taElementT ag | |
| 141 | * @param Va lueReprese ntation vr Field | |
| 142 | * @param va lueLength | |
| 143 | * @param va lue | |
| 144 | * @return | |
| 145 | * / | |
| 146 | pu blic DataE lement<?> createData Element( | |
| 147 | DataEl ementTag d ataElement Tag, | |
| 148 | ValueR epresentat ion vrFiel d, // m ust be nul l if impli cit VR, mu st be non- null if ex plicit VR | |
| 149 | long v alueLength , | |
| 150 | byte[] value) | |
| 151 | th rows Inval idVRModeEx ception | |
| 152 | { | |
| 153 | Data Element<?> dataEleme nt = null; | |
| 154 | ||
| 155 | try | |
| 156 | { | |
| 157 | if( ! isExplic itVR() || | |
| 158 | DataEl ementTag.S EQUENCE_DE LIMITATION _TAG.equal s(dataElem entTag) || | |
| 159 | DataEl ementTag.I TEM_DELIMI TATION_TAG .equals(da taElementT ag) || | |
| 160 | DataEl ementTag.S EQUENCE_IT EM_TAG.equ als(dataEl ementTag) ) | |
| 161 | { | |
| 162 | DicomD ictionaryE ntry dicti onaryEntry = diction ary.get(da taElementT ag); | |
| 163 | ||
| 164 | // cre ate a tag if it is n ot in the dictionary | |
| 165 | if(dic tionaryEnt ry == null && isCrea teUnknownD ataElement Tag()) | |
| 166 | { | |
| 167 | String u serEntryNa me = dicti onary.crea teUserEntr y(dataElem entTag); | |
| 168 | dictiona ryEntry = dictionary .get(userE ntryName); | |
| 169 | } | |
| 170 | ||
| 171 | Class< ? extends DataElemen t<?>> data ElementCla ss = dicti onaryEntry .getVr()[0 ].getDataE lementClas s(); | |
| 172 | Constr uctor<? ex tends Data Element<?> > construc tor = | |
| 173 | dataElem entClass.g etConstruc tor(DataEl ementFacto ry.class, DataElemen tTag.class , DicomDic tionaryEnt ry.class, long.class , byte[].c lass ); | |
| 174 | ||
| 175 | dataEl ement = (D ataElement <?>)constr uctor.newI nstance(th is, dataEl ementTag, dictionary Entry, val ueLength, value); | |
| 176 | } | |
| 177 | else | |
| 178 | { | |
| 179 | if(vrF ield == nu ll) | |
| 180 | throw ne w Unspecif iedVRWithE xplicitVRE xception() ; | |
| 181 | ||
| 182 | Class< ? extends DataElemen t<?>> data ElementCla ss = vrFie ld.getData ElementCla ss(); | |
| 183 | Constr uctor<? ex tends Data Element<?> > construc tor = | |
| 184 | dataElem entClass.g etConstruc tor(DataEl ementFacto ry.class, DataElemen tTag.class , ValueRep resentatio n.class, l ong.class, byte[].cl ass ); | |
| 185 | ||
| 186 | dataEl ement = (D ataElement <?>)constr uctor.newI nstance(th is, dataEl ementTag, vrField, v alueLength , value); | |
| 187 | } | |
| 188 | } | |
| 189 | catc h (Invocat ionTargetE xception i tX) | |
| 190 | { | |
| 191 | logger .error("Er ror creati ng DataEle ment", itX .getCause( )); | |
| 192 | } | |
| 193 | catc h (Excepti on e) | |
| 194 | { | |
| 195 | logger .error("Er ror creati ng DataEle ment", e); | |
| 196 | } | |
| 197 | ||
| 198 | retu rn dataEle ment; | |
| 199 | } | |
| 200 | ||
| 201 | /* * | |
| 202 | * Return th e first VR associate d to the g iven DataE lementTag (group and element n umber) | |
| 203 | * using the dictionar y associat ed to this factory. | |
| 204 | * | |
| 205 | * @param da taElementT ag | |
| 206 | * @return | |
| 207 | * / | |
| 208 | pu blic Value Representa tion getIm plicitVR(D ataElement Tag dataEl ementTag) | |
| 209 | { | |
| 210 | Dico mDictionar yEntry ent ry = getDi ctionary() .getByElem entKey(dat aElementTa g); | |
| 211 | retu rn (entry == null ? null : ent ry.getVr() [0]); | |
| 212 | } | |
| 213 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.