Produced by Araxis Merge on 12/5/2017 12:06:44 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\ImagingDicomDCFUtilities\src\java\gov\va\med\imaging\dicom\dcftoolkit\utilities\reconstitution | DicomFileExtractor.java | Mon Dec 4 21:35:16 2017 UTC |
| 2 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ImagingDicomDCFUtilities\src\java\gov\va\med\imaging\dicom\dcftoolkit\utilities\reconstitution | DicomFileExtractor.java | Mon Dec 4 22:02:42 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 372 |
| 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 | Package: MAG - Vis tA Imaging | |
| 4 | WARNING: Per VHA D irective 2 004-038, t his routin e should n ot be modi fied. | |
| 5 | Date Cre ated: Dece mber 13, 2 006 | |
| 6 | Site Nam e: Washin gton OI Fi eld Office , Silver S pring, MD | |
| 7 | Developer:
|
|
| 8 | Descript ion: | |
| 9 | ||
| 10 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
| 11 | ;; Property of the US Government . | |
| 12 | ;; No permis sion to co py or redi stribute t his softwa re is give n. | |
| 13 | ;; Use of un released v ersions of this soft ware requi res the us er | |
| 14 | ;; to execu te a writt en test ag reement wi th the Vis tA Imaging | |
| 15 | ;; Developm ent Office of the De partment o f Veterans Affairs, | |
| 16 | ;; telephon e (301) 73 4-0100. | |
| 17 | ;; | |
| 18 | ;; The Food and Drug A dministrat ion classi fies this software a s | |
| 19 | ;; a Class I I medical device. A s such, it may not b e changed | |
| 20 | ;; in any wa y. Modifi cations to this soft ware may r esult in a n | |
| 21 | ;; adulterat ed medical device un der 21CFR8 20, the us e of which | |
| 22 | ;; is consid ered to be a violati on of US F ederal Sta tutes. | |
| 23 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
| 24 | */ | |
| 25 | package go v.va.med.i maging.dic om.dcftool kit.utilit ies.recons titution; | |
| 26 | ||
| 27 | // import java.io.By teArrayOut putStream; | |
| 28 | // import java.io.IO Exception; | |
| 29 | // import java.nio.B yteOrder; | |
| 30 | ||
| 31 | import gov .va.med.im aging.Size dInputStre am; | |
| 32 | import gov .va.med.im aging.dico m.common.i nterfaces. IDicomData Set; | |
| 33 | import gov .va.med.im aging.dico m.dcftoolk it.common. impl.Dicom DataSetImp l; | |
| 34 | import gov .va.med.im aging.dico m.dcftoolk it.utiliti es.excepti ons.DicomF ileExcepti on; | |
| 35 | ||
| 36 | import org .apache.lo gging.log4 j.LogManag er; | |
| 37 | import org .apache.lo gging.log4 j.Logger; | |
| 38 | ||
| 39 | import com .lbs.DCS.A ttributeTa g; | |
| 40 | import com .lbs.DCS.D CSExceptio n; | |
| 41 | import com .lbs.DCS.D icomDataSe t; | |
| 42 | import com .lbs.DCS.D icomElemen t; | |
| 43 | import com .lbs.DCS.D icomFileIn put; | |
| 44 | import com .lbs.DCS.D icomSessio nSettings; | |
| 45 | import com .lbs.DCS.D icomStream Reader; | |
| 46 | ||
| 47 | /** | |
| 48 | * | |
| 49 | * @author William P eterson | |
| 50 | * | |
| 51 | */ | |
| 52 | public cla ss DicomFi leExtracto r { | |
| 53 | // IMPROVE Co rrect this class to match my i mplementat ion in P66 . In P66, this clas s did not have insta nce variab les. | |
| 54 | IDicom DataSet to olkitDDS; | |
| 55 | DicomD ataSet dD S; | |
| 56 | ||
| 57 | //priv ate static Logger LO GGER = Log Manager.ge tLogger (D icomFileEx tractor.cl ass); | |
| 58 | pr ivate stat ic Logger logger = L ogManager. getLogger (DicomFile Extractor. class); | |
| 59 | ||
| 60 | /** | |
| 61 | * Con structor | |
| 62 | * | |
| 63 | * | |
| 64 | */ | |
| 65 | public DicomFile Extractor( ) { | |
| 66 | su per(); | |
| 67 | // TODO Auto -generated construct or stub | |
| 68 | } | |
| 69 | ||
| 70 | public IDicomDat aSet getDD SFromDicom File(Strin g dicomFil e)throws D icomFileEx ception{ | |
| 71 | ||
| 72 | Di comFileInp ut fileInp ut = null; | |
| 73 | th is.dDS = n ull; | |
| 74 | St ring tsUID = null; | |
| 75 | ||
| 76 | tr y{ | |
| 77 | fileInpu t = new Di comFileInp ut(dicomFi le); | |
| 78 | fileInpu t.open(); | |
| 79 | this.dDS = fileInp ut.readDat aSet(); | |
| 80 | tsUID = fileInput. getActualT SUID(); | |
| 81 | if(fileI nput.chapt er10Encodi ng()){ | |
| 82 | logg er.debug(t his.getCla ss().getNa me()+": Ch apter 10 E ncoding.") ; | |
| 83 | } | |
| 84 | else{ | |
| 85 | logg er.debug(t his.getCla ss().getNa me()+": No t Chapter 10 Encodin g."); | |
| 86 | } | |
| 87 | logger.d ebug("Tran sfer Synta x is "+fil eInput.tra nsferSynta x()); | |
| 88 | //IMPROV E I have t his commen ted out fo r a reason in P66. Test it bo th ways. | |
| 89 | fileInpu t.close(); | |
| 90 | } | |
| 91 | ca tch(DCSExc eption dcs e){ | |
| 92 | logger.e rror(dcse. getMessage ()); | |
| 93 | logger.e rror(this. getClass() .getName() +": Dicom Toolkit la yer: " + | |
| 94 | "Exception thrown wh ile gettin g Dicom Da taset from Dicom Fil e."); | |
| 95 | throw ne w DicomFil eException ("Failure to extract Dicom Dat aset from Dicom file "+dicomFi le+".",dcs e); | |
| 96 | } | |
| 97 | fi nally{ | |
| 98 | if(f ileInput ! = null){ | |
| 99 | try{ | |
| 100 | fileInpu t.close(); | |
| 101 | } | |
| 102 | catch (Throwable T){ | |
| 103 | logger.e rror(this. getClass() .getName() +": Dicom Toolkit la yer: "+ | |
| 104 | "E xception t hrown whil e closing Dicom File "+dicomFi le+"."); | |
| 105 | } | |
| 106 | System .gc(); | |
| 107 | } | |
| 108 | } | |
| 109 | th is.removeM etaData(th is.dDS); | |
| 110 | re turn this. encapsulat eDDS(tsUID ); | |
| 111 | } | |
| 112 | ||
| 113 | public IDicomDat aSet getDD SFromDicom Stream(Siz edInputStr eam sizedD icomStream )throws Di comFileExc eption{ | |
| 114 | ||
| 115 | String tsUID = n ull; | |
| 116 | try{ | |
| 117 | // read Inpu tStream in to a ByteB uffer | |
| 118 | Di comSession Settings d ss = new D icomSessio nSettings( ); | |
| 119 | Di comStreamR eader read er = new D icomStream Reader(siz edDicomStr eam.getInS tream(), d ss); | |
| 120 | DicomFil eInput dfi = new Dic omFileInpu t( | |
| 121 | read er, | |
| 122 | null , // UID.T RANSFERLIT TLEENDIAN, cpt 4/12/ 11 -- remo ved as DCF 3.3.22c f igures the right TS of of a pa rt10 file! (and we u se only Pa rt10 files )! | |
| 123 | dss ); | |
| 124 | dD S = dfi.re adDataSet( ); | |
| 125 | ts UID = dfi. getActualT SUID(); | |
| 126 | } | |
| 127 | ca tch(DCSExc eption dcs e){ | |
| 128 | logger.e rror("Erro r: " + dcs e.getMessa ge()); | |
| 129 | logger.e rror("Dico m Toolkit layer: " + | |
| 130 | "Exception thrown wh ile gettin g Dicom Da taset from Dicom Str eam."); | |
| 131 | throw ne w DicomFil eException ("Failure to extract Dicom Dat aset from Dicom Stre am.", dcse ); | |
| 132 | } | |
| 133 | th is.removeM etaData(th is.dDS); | |
| 134 | re turn this. encapsulat eDDS(tsUID ); | |
| 135 | } | |
| 136 | ||
| 137 | //IMPR OVE Make i t configur able outsi de of this class. | |
| 138 | privat e void rem oveElement (String el ement){ | |
| 139 | bo olean elem entRemoved =false; | |
| 140 | tr y{ | |
| 141 | Attr ibuteTag a T = new At tributeTag (element); | |
| 142 | elem entRemoved =dDS.remov eElement(a T); | |
| 143 | } | |
| 144 | ca tch(DCSExc eption e){ | |
| 145 | } | |
| 146 | if (elementR emoved){ | |
| 147 | logger.i nfo("DICOM Element ( " + elemen t + ") rem oved"); | |
| 148 | } | |
| 149 | } | |
| 150 | ||
| 151 | privat e void rem oveMetaDat a(DicomDat aSet dds){ | |
| 152 | bo olean isMe taData = t rue; | |
| 153 | in t i = 0; | |
| 154 | wh ile (isMet aData){ | |
| 155 | Dico mElement e lement = d ds.getElem entAt(i); | |
| 156 | Attr ibuteTag t ag = eleme nt.tag(); | |
| 157 | int group = ta g.group(); | |
| 158 | if(g roup <= 0x 0002){ | |
| 159 | dds.re moveElemen t(tag); | |
| 160 | } | |
| 161 | else { | |
| 162 | isMeta Data = fal se; | |
| 163 | } | |
| 164 | } | |
| 165 | } | |
| 166 | ||
| 167 | privat e IDicomDa taSet enca psulateDDS (String tr ansferSynt ax){ | |
| 168 | ||
| 169 | lo gger.info( "...Encaps ulating Di comDataSet ..."); | |
| 170 | // Remove un wanted GE private ta gs | |
| 171 | // IMPROVE M ake config urable out side of th is class. | |
| 172 | re moveElemen t("6003,00 10"); | |
| 173 | re moveElemen t("6003,10 10"); | |
| 174 | re moveElemen t("7fe1,00 10"); | |
| 175 | re moveElemen t("7fe1,10 01"); | |
| 176 | tr y{ | |
| 177 | toolkitD DS = new D icomDataSe tImpl(dDS) ; | |
| 178 | toolkitD DS.setRece ivedTransf erSyntax(t ransferSyn tax); | |
| 179 | } | |
| 180 | ca tch(Except ion e){ | |
| 181 | logger.e rror("Erro r: " + e.g etMessage( )); | |
| 182 | logger.e rror("Dico m Toolkit layer: Exc eption thr own while encapsulat ing the Di com DataSe t."); | |
| 183 | e.printS tackTrace( ); | |
| 184 | } | |
| 185 | re turn toolk itDDS; | |
| 186 | } | |
| 187 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.