Produced by Araxis Merge on 12/5/2017 12:06:41 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\Hi5\src\gov\va\med\imaging\hi5\client | DicomDataSetDataSource.java | Mon Dec 4 21:34:28 2017 UTC |
| 2 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\Hi5\src\gov\va\med\imaging\hi5\client | DicomDataSetDataSource.java | Mon Dec 4 22:00:52 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 526 |
| 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 | * | |
| 3 | */ | |
| 4 | package go v.va.med.i maging.hi5 .client; | |
| 5 | ||
| 6 | import gov .va.med.im aging.dico m.dataset. DataSet; | |
| 7 | import gov .va.med.im aging.hi5. client.Dat aSourceEve nt.DataEve ntType; | |
| 8 | import gov .va.med.im aging.hi5. shared.Bas e64Coder; | |
| 9 | import gov .va.med.im aging.hi5. shared.HTT PHeaders; | |
| 10 | ||
| 11 | import jav a.util.Arr ayList; | |
| 12 | import jav a.util.Lis t; | |
| 13 | import org .apache.lo gging.log4 j.LogManag er; | |
| 14 | import org .apache.lo gging.log4 j.Logger; | |
| 15 | ||
| 16 | import com .google.gw t.core.cli ent.GWT; | |
| 17 | import com .google.gw t.http.cli ent.Reques t; | |
| 18 | import com .google.gw t.http.cli ent.Reques tBuilder; | |
| 19 | import com .google.gw t.http.cli ent.Reques tCallback; | |
| 20 | import com .google.gw t.http.cli ent.Reques tException ; | |
| 21 | import com .google.gw t.http.cli ent.Respon se; | |
| 22 | import com .google.gw t.http.cli ent.URL; | |
| 23 | import com .google.gw t.user.cli ent.Window ; | |
| 24 | import com .google.gw t.user.cli ent.rpc.As yncCallbac k; | |
| 25 | ||
| 26 | /** | |
| 27 | * @author
|
|
| 28 | * | |
| 29 | */ | |
| 30 | public cla ss DicomDa taSetDataS ource | |
| 31 | { | |
| 32 | privat e static f inal Strin g DICOM_IM AGE_PIXELS _PATH = "/ Hi5/dicomI magePixels /"; | |
| 33 | privat e Logger l ogger = Lo gManager.g etLogger(" DicomDataS etDataSour ce"); | |
| 34 | ||
| 35 | privat e final Di comService Async serv ice = GWT. create(Dic omService. class); | |
| 36 | ||
| 37 | privat e String i mageURN = null; | |
| 38 | privat e DataSet currentDat aSet = nul l; | |
| 39 | privat e byte[] c urrentPixe lData = nu ll; | |
| 40 | privat e int curr entPixelDa taWidth = 0; | |
| 41 | privat e int curr entPixelDa taHeight = 0; | |
| 42 | privat e int curr entPixelDa taDepth = 0; | |
| 43 | privat e List<Dat aSourceEve ntListener > dataSour ceEventLis teners = n ew ArrayLi st<DataSou rceEventLi stener>(); | |
| 44 | ||
| 45 | /** | |
| 46 | * @pa ram jsObj | |
| 47 | */ | |
| 48 | public DicomData SetDataSou rce() | |
| 49 | { | |
| 50 | } | |
| 51 | ||
| 52 | // === ========== ========== ========== ========== ========== ========== ========== ========== ========= | |
| 53 | // Vis ible State Managemen t | |
| 54 | // === ========== ========== ========== ========== ========== ========== ========== ========== ========= | |
| 55 | privat e void set CurrentIma geUrn(Stri ng imageUr n) | |
| 56 | { | |
| 57 | th is.imageUR N = imageU rn; | |
| 58 | } | |
| 59 | ||
| 60 | public String ge tCurrentIm ageUrn() | |
| 61 | { | |
| 62 | re turn this. imageURN; | |
| 63 | } | |
| 64 | ||
| 65 | privat e void set CurrentDat aSet(DataS et dataSet ) | |
| 66 | { | |
| 67 | th is.current DataSet = dataSet; | |
| 68 | } | |
| 69 | public DataSet g etCurrentD ataSet() | |
| 70 | { | |
| 71 | re turn this. currentDat aSet; | |
| 72 | } | |
| 73 | ||
| 74 | public byte[] ge tCurrentPi xelData() | |
| 75 | { | |
| 76 | re turn curre ntPixelDat a; | |
| 77 | } | |
| 78 | ||
| 79 | privat e void set CurrentPix elData(byt e[] curren tPixelData ) | |
| 80 | { | |
| 81 | th is.current PixelData = currentP ixelData; | |
| 82 | } | |
| 83 | ||
| 84 | public int getCu rrentPixel DataWidth( ) | |
| 85 | { | |
| 86 | re turn curre ntPixelDat aWidth; | |
| 87 | } | |
| 88 | ||
| 89 | privat e void set CurrentPix elDataWidt h(int curr entPixelDa taWidth) | |
| 90 | { | |
| 91 | th is.current PixelDataW idth = cur rentPixelD ataWidth; | |
| 92 | } | |
| 93 | ||
| 94 | public int getCu rrentPixel DataHeight () | |
| 95 | { | |
| 96 | re turn curre ntPixelDat aHeight; | |
| 97 | } | |
| 98 | ||
| 99 | privat e void set CurrentPix elDataHeig ht(int cur rentPixelD ataHeight) | |
| 100 | { | |
| 101 | th is.current PixelDataH eight = cu rrentPixel DataHeight ; | |
| 102 | } | |
| 103 | ||
| 104 | public int getCu rrentPixel DataDepth( ) | |
| 105 | { | |
| 106 | re turn curre ntPixelDat aDepth; | |
| 107 | } | |
| 108 | ||
| 109 | public void setC urrentPixe lDataDepth (int curre ntPixelDat aDepth) | |
| 110 | { | |
| 111 | th is.current PixelDataD epth = cur rentPixelD ataDepth; | |
| 112 | } | |
| 113 | ||
| 114 | // === ========== ========== ========== ========== ========== ========== ========== ========== ========= | |
| 115 | // Lis tener Mana gement | |
| 116 | // === ========== ========== ========== ========== ========== ========== ========== ========== ========= | |
| 117 | public void addD ataSourceE ventListen er(DataSou rceEventLi stener lis tener) | |
| 118 | { | |
| 119 | if (listener != null) | |
| 120 | dataSour ceEventLis teners.add (listener) ; | |
| 121 | } | |
| 122 | public boolean r emovedataS ourceEvent Listener(D ataSourceE ventListen er listene r) | |
| 123 | { | |
| 124 | re turn dataS ourceEvent Listeners. remove(lis tener); | |
| 125 | } | |
| 126 | privat e void not ifyDataSou rceEventLi steners(Da taSourceEv ent event) | |
| 127 | { | |
| 128 | fo r(DataSour ceEventLis tener list ener : dat aSourceEve ntListener s) | |
| 129 | listener .dataEvent (event); | |
| 130 | } | |
| 131 | ||
| 132 | /** | |
| 133 | * | |
| 134 | * @pa ram reques tId | |
| 135 | * @pa ram reques t | |
| 136 | * @pa ram respon se | |
| 137 | */ | |
| 138 | public void fetc h(String i mageUrn) | |
| 139 | { | |
| 140 | lo gger.info( "calling s ervice.get DicomDataS et(" + ima geUrn + ") "); | |
| 141 | if (imageUrn != null) | |
| 142 | { | |
| 143 | logger.i nfo("befor e calling getDataSet (" + image Urn + ")") ; | |
| 144 | service. getDataSet (imageUrn, new Fetch DicomDataS etCallback (imageUrn) ); | |
| 145 | logger.i nfo("after calling g etDataSet( " + imageU rn + ")"); | |
| 146 | ||
| 147 | String i magePixels Url = "htt p://" + ge tDicomPixe lsSourceHo stAndConte xt() + ima geUrn; | |
| 148 | //String imageData SetUrl = " http://" + getDicomD ataSetSour ceHostAndC ontext() + imageId; | |
| 149 | loadDico mPixels(im agePixelsU rl); | |
| 150 | } | |
| 151 | } | |
| 152 | ||
| 153 | /** | |
| 154 | * | |
| 155 | * @pa ram url | |
| 156 | */ | |
| 157 | privat e void loa dDicomPixe ls(String url) | |
| 158 | { | |
| 159 | Re questBuild er builder = new Req uestBuilde r(RequestB uilder.GET , URL.enco de(url)); | |
| 160 | bu ilder.setH eader("Acc ept-type", HTTPHeade rs.ACCEPT_ TYPE_DICOM ); | |
| 161 | bu ilder.setH eader("Acc ept-encodi ng", HTTPH eaders.ACC EPT_ENCODI NG_BASE64) ; | |
| 162 | ||
| 163 | tr y | |
| 164 | { | |
| 165 | builder. setTimeout Millis(500 0); | |
| 166 | builder. sendReques t(null, ne w GetDicom PixelsCall back()); | |
| 167 | } | |
| 168 | ca tch (Reque stExceptio n e) | |
| 169 | { | |
| 170 | logger.e rror("Unab le to conn ect to ser ver, " + e .getMessag e()); | |
| 171 | } | |
| 172 | } | |
| 173 | ||
| 174 | privat e String g etDicomPix elsSourceH ostAndCont ext() | |
| 175 | { | |
| 176 | re turn Windo w.Location .getHost() + DICOM_I MAGE_PIXEL S_PATH; | |
| 177 | } | |
| 178 | ||
| 179 | // === ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== == | |
| 180 | // Met adata Call back Class es | |
| 181 | // === ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== == | |
| 182 | ||
| 183 | /** | |
| 184 | * @author
|
|
| 185 | * | |
| 186 | */ | |
| 187 | abstra ct class D icomDataSe tCallback | |
| 188 | { | |
| 189 | pr ivate fina l String i mageUrn; | |
| 190 | pu blic Dicom DataSetCal lback(Stri ng imageUr n) | |
| 191 | { | |
| 192 | super(); | |
| 193 | this.ima geUrn = im ageUrn; | |
| 194 | } | |
| 195 | pu blic Strin g getImage Urn() | |
| 196 | { | |
| 197 | return t his.imageU rn; | |
| 198 | } | |
| 199 | } | |
| 200 | ||
| 201 | class FetchDicom DataSetCal lback | |
| 202 | extend s DicomDat aSetCallba ck | |
| 203 | implem ents Async Callback<D ataSet> | |
| 204 | { | |
| 205 | pu blic Fetch DicomDataS etCallback (String im ageUrn) | |
| 206 | { | |
| 207 | super(im ageUrn); | |
| 208 | } | |
| 209 | ||
| 210 | pu blic void onSuccess( DataSet da taSet) | |
| 211 | { | |
| 212 | setCurre ntImageUrn (getImageU rn()); | |
| 213 | setCurre ntDataSet( dataSet); | |
| 214 | notifyDa taSourceEv entListene rs(new Dat aSourceEve nt(DataEve ntType.DAT A_NEW_EVEN T)); | |
| 215 | } | |
| 216 | ||
| 217 | pu blic void onFailure( Throwable caught) | |
| 218 | { | |
| 219 | caught.p rintStackT race(); | |
| 220 | notifyDa taSourceEv entListene rs(new Dat aSourceEve nt(DataEve ntType.DAT A_ERROR_EV ENT)); | |
| 221 | } | |
| 222 | } | |
| 223 | ||
| 224 | // === ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== == | |
| 225 | // Pix el Callbac k Classes | |
| 226 | // === ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== == | |
| 227 | ||
| 228 | /** | |
| 229 | * | |
| 230 | */ | |
| 231 | class GetDicomPi xelsCallba ck | |
| 232 | implem ents Reque stCallback | |
| 233 | { | |
| 234 | pu blic void onResponse Received(R equest req uest, Resp onse respo nse) | |
| 235 | { | |
| 236 | if (200 == respons e.getStatu sCode()) | |
| 237 | { | |
| 238 | Stri ng widthPa ram = resp onse.getHe ader(HTTPH eaders.IMA GE_WIDTH_H EADER); | |
| 239 | Stri ng heightP aram = res ponse.getH eader(HTTP Headers.IM AGE_HEIGHT _HEADER); | |
| 240 | Stri ng bitsPer PixelParam = respons e.getHeade r(HTTPHead ers.IMAGE_ BITDEPTH_H EADER); | |
| 241 | int height = I nteger.par seInt(heig htParam); | |
| 242 | int width = In teger.pars eInt(width Param); | |
| 243 | int bitsPerPix el = Integ er.parseIn t(bitsPerP ixelParam) ; | |
| 244 | ||
| 245 | // b yte array should be interprete d as an in teger arra y | |
| 246 | byte [] byteDat a = Base64 Coder.deco de(respons e.getText( )); | |
| 247 | setC urrentPixe lData(byte Data); | |
| 248 | setC urrentPixe lDataDepth (bitsPerPi xel); | |
| 249 | setC urrentPixe lDataHeigh t(height); | |
| 250 | setC urrentPixe lDataWidth (width); | |
| 251 | ||
| 252 | noti fyDataSour ceEventLis teners(new DataSourc eEvent(Dat aEventType .PIXELS_NE W_EVENT)); | |
| 253 | } | |
| 254 | else | |
| 255 | { | |
| 256 | noti fyDataSour ceEventLis teners(new DataSourc eEvent(Dat aEventType .PIXELS_ER ROR_EVENT) ); | |
| 257 | } | |
| 258 | } | |
| 259 | ||
| 260 | pu blic void onError(Re quest requ est, Throw able excep tion) | |
| 261 | { | |
| 262 | notifyDa taSourceEv entListene rs(new Dat aSourceEve nt(DataEve ntType.PIX ELS_ERROR_ EVENT)); | |
| 263 | } | |
| 264 | } | |
| 265 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.