Produced by Araxis Merge on 12/5/2017 12:06:40 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\ExchangeWebApp\main\src\java\gov\va\med\imaging\exchange\webservices\translator\v1 | ExchangeTranslator.java | Mon Dec 4 21:35:28 2017 UTC |
| 2 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ExchangeWebApp\main\src\java\gov\va\med\imaging\exchange\webservices\translator\v1 | ExchangeTranslator.java | Mon Dec 4 22:00:21 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 962 |
| 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 | 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: Jan 30, 2008 | |
| 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 | */ | |
| 26 | package go v.va.med.i maging.exc hange.webs ervices.tr anslator.v 1; | |
| 27 | ||
| 28 | import jav a.text.Dat eFormat; | |
| 29 | import jav a.text.Par seExceptio n; | |
| 30 | import jav a.text.Sim pleDateFor mat; | |
| 31 | import jav a.util.Arr ayList; | |
| 32 | import jav a.util.Dat e; | |
| 33 | import jav a.util.Ite rator; | |
| 34 | import jav a.util.Lis t; | |
| 35 | import jav a.util.Set ; | |
| 36 | import org .apache.lo gging.log4 j.LogManag er; | |
| 37 | import org .apache.lo gging.log4 j.Logger; | |
| 38 | import gov .va.med.Im ageURNFact ory; | |
| 39 | import gov .va.med.UR NFactory; | |
| 40 | import gov .va.med.im aging.*; | |
| 41 | import gov .va.med.im aging.exce ptions.Ima geURNForma tException ; | |
| 42 | import gov .va.med.im aging.exce ptions.URN FormatExce ption; | |
| 43 | import gov .va.med.im aging.exch ange.Excha ngeFilter; | |
| 44 | import gov .va.med.im aging.exch ange.Proce dureFilter ; | |
| 45 | import gov .va.med.im aging.exch ange.busin ess.Image; | |
| 46 | import gov .va.med.im aging.exch ange.busin ess.Series ; | |
| 47 | import gov .va.med.im aging.exch ange.busin ess.Study; | |
| 48 | import gov .va.med.im aging.exch ange.busin ess.StudyF ilter; | |
| 49 | import gov .va.med.im aging.exch ange.enums .PatientSe nsitivityL evel; | |
| 50 | import gov .va.med.im aging.exch ange.enums .Procedure FilterMatc hMode; | |
| 51 | import gov .va.med.im aging.exch ange.webse rvices.soa p.types.v1 .Modalitie sType; | |
| 52 | import gov .va.med.im aging.exch ange.webse rvices.soa p.types.v1 .StudyType ; | |
| 53 | ||
| 54 | /** | |
| 55 | * @author
|
|
| 56 | * | |
| 57 | */ | |
| 58 | public cla ss Exchang eTranslato r | |
| 59 | { | |
| 60 | pr ivate fina l static L ogger logg er = LogMa nager.getL ogger(Exch angeTransl ator.class ); | |
| 61 | ||
| 62 | // private fi nal static String we bserviceDa teFormat = "yyyyMMdd HHmmss.SSS SSSZ"; | |
| 63 | // be carefu l about re -using Sim pleDateFor mat instan ces becaus e they are not threa d-safe | |
| 64 | pr ivate Date Format get Webservice DateFormat () | |
| 65 | { | |
| 66 | retu rn new Dic omDateForm at(); | |
| 67 | //re turn new S impleDateF ormat(webs erviceDate Format); | |
| 68 | } | |
| 69 | ||
| 70 | pu blic Study Filter tra nsformFilt er(gov.va. med.imagin g.exchange .webservic es.soap.ty pes.v1.Fil terType fi lterType) { | |
| 71 | ||
| 72 | //(c redentials == null ? "null" : credential s.toString ()) + ")") | |
| 73 | ||
| 74 | Proc edureFilte r filter = new Proce dureFilter (Procedure FilterMatc hMode.exis tInProcedu reList); | |
| 75 | // J MW - for n ow set to level 2 as allowed, might chan ge later i f can get informatio n from DoD | |
| 76 | // t his is the same leve l we have always bee n providin g to the D oD. | |
| 77 | filt er.setMaxi mumAllowed Level(Pati entSensiti vityLevel. DISPLAY_WA RNING_REQU IRE_OK); | |
| 78 | if(f ilterType != null) | |
| 79 | { | |
| 80 | DateFo rmat df = getWebserv iceDateFor mat(); | |
| 81 | ||
| 82 | Date f romDate = null; | |
| 83 | try | |
| 84 | { | |
| 85 | fromDate = filterT ype.getFro mDate() == null || f ilterType. getFromDat e().length () == 0 ? | |
| 86 | nu ll : | |
| 87 | df .parse(fil terType.ge tFromDate( )); | |
| 88 | } | |
| 89 | catch (ParseExce ption x) | |
| 90 | { | |
| 91 | logger.e rror("Pars eException convertin g webservi ce format string fro m-date '" + filterT ype.getFro mDate() + "' to inte rnal Date" , x); | |
| 92 | fromDate = null; | |
| 93 | } | |
| 94 | ||
| 95 | Date t oDate = nu ll; | |
| 96 | try | |
| 97 | { | |
| 98 | toDate = filterTyp e.getToDat e() == nul l || filte rType.getT oDate().le ngth() == 0 ? | |
| 99 | nu ll : | |
| 100 | df .parse(fil terType.ge tToDate()) ; | |
| 101 | } | |
| 102 | catch (ParseExce ption x) | |
| 103 | { | |
| 104 | logger.e rror("Pars eException convertin g webservi ce format string to- date '" + filterTyp e.getToDat e() + "' t o internal Date", x) ; | |
| 105 | toDate = null; | |
| 106 | } | |
| 107 | ||
| 108 | filter .setFromDa te(fromDat e); | |
| 109 | filter .setToDate (toDate); | |
| 110 | // the study Id recieved i n the filt er (from t he DOD) sh ould be th e entire s tudy URN | |
| 111 | // nee d to conve rt that to just the internal s tudy Id va lue (IEN) | |
| 112 | if(fil terType.ge tStudyId() == null) | |
| 113 | { | |
| 114 | filter.s etStudyId( null); | |
| 115 | } | |
| 116 | else { | |
| 117 | try { | |
| 118 | StudyURN s tudyUrn = URNFactory .create(fi lterType.g etStudyId( ), StudyUR N.class); | |
| 119 | filter.set StudyId(st udyUrn); | |
| 120 | } | |
| 121 | catch(Cl assCastExc eption ccX ) { | |
| 122 | filter.set StudyId(nu ll); | |
| 123 | } | |
| 124 | catch(UR NFormatExc eption iur nfX) { | |
| 125 | filter.set StudyId(nu ll); | |
| 126 | } | |
| 127 | ||
| 128 | } | |
| 129 | //filt er.setStud yId(filter Type.getSt udyId() == null ? "" : filterT ype.getStu dyId()); | |
| 130 | } | |
| 131 | retu rn filter; | |
| 132 | } | |
| 133 | ||
| 134 | /* | |
| 135 | pu blic Study Filter tra nsformFilt er(gov.va. med.imagin g.exchange .webservic es.soap.ty pes.v1.Fil terType fi lter) | |
| 136 | { | |
| 137 | if(f ilter == n ull) | |
| 138 | return null; | |
| 139 | Date fromDate = null; | |
| 140 | if(f ilter.getF romDate() != null) | |
| 141 | { | |
| 142 | fromDa te = Excha ngeUtil.co nvertDICOM DateToDate (filter.ge tFromDate( )); | |
| 143 | } | |
| 144 | Date toDate = null; | |
| 145 | if(f ilter.getT oDate() != null) | |
| 146 | { | |
| 147 | toDate = Exchang eUtil.conv ertDICOMDa teToDate(f ilter.getT oDate()); | |
| 148 | } | |
| 149 | Stud yFilter st udyFilter = new Stud yFilter(fr omDate, to Date, filt er.getStud yId()); | |
| 150 | retu rn studyFi lter; | |
| 151 | } | |
| 152 | */ | |
| 153 | pu blic Strin g translat eProcedure DateToDico m(Date pro cedureDate ) | |
| 154 | th rows Parse Exception | |
| 155 | { | |
| 156 | Stri ng procedu reDateStri ngAsDicom = ""; | |
| 157 | if(p rocedureDa te != null ) | |
| 158 | { | |
| 159 | DateFo rmat dicom DateFormat = new Dic omDateForm at(); | |
| 160 | proced ureDateStr ingAsDicom = dicomDa teFormat.f ormat(proc edureDate) ; | |
| 161 | } | |
| 162 | retu rn procedu reDateStri ngAsDicom; | |
| 163 | } | |
| 164 | ||
| 165 | /* * | |
| 166 | * Translate a String date into a DICOM fo rmatted St ring date. | |
| 167 | * | |
| 168 | * @param da teString | |
| 169 | * @return | |
| 170 | * @throws P arseExcept ion | |
| 171 | * / | |
| 172 | pu blic Strin g translat eProcedure DateToDico m(String d ateString) | |
| 173 | th rows Parse Exception | |
| 174 | { | |
| 175 | Stri ng procedu reDateStri ngAsDicom = ""; | |
| 176 | if ( dateString != null) | |
| 177 | { | |
| 178 | String trimmedDa teString = dateStrin g.trim(); | |
| 179 | if (tr immedDateS tring.leng th() > 0) | |
| 180 | { | |
| 181 | DateForm at procedu reDateForm at = null; | |
| 182 | DateForm at dicomDa teFormat = new Dicom DateFormat (); | |
| 183 | // post patch 59 d ates inclu de time-of -day segme nt | |
| 184 | procedur eDateForma t = dateSt ring.index Of(":") >= 0 ? | |
| 185 | new Simple DateFormat ("MM/dd/yy yy HH:mm") : | |
| 186 | new Simple DateFormat ("MM/dd/yy yy"); | |
| 187 | Date pro cedureDate = procedu reDateForm at.parse(t rimmedDate String); | |
| 188 | procedur eDateStrin gAsDicom = dicomDate Format.for mat(proced ureDate); | |
| 189 | } | |
| 190 | } | |
| 191 | retu rn procedu reDateStri ngAsDicom; | |
| 192 | } | |
| 193 | ||
| 194 | pu blic Study Type trans formStudy( Study stud y) | |
| 195 | th rows URNFo rmatExcept ion, Parse Exception | |
| 196 | { | |
| 197 | if(s tudy == nu ll) | |
| 198 | return null; | |
| 199 | // d on't retur n the stud y if there is a ques tionable i ntegrity/e rror condi tion | |
| 200 | if(s tudy.hasEr rorMessage ()) | |
| 201 | { | |
| 202 | logger .debug("St udy [" + s tudy.getSt udyIen() + "] has er ror messag e, excludi ng from re sults."); | |
| 203 | return null; | |
| 204 | } | |
| 205 | if(s tudy.isDel eted()) | |
| 206 | { | |
| 207 | logger .debug("St udy [" + s tudy.getSt udyIen() + "] is del eted, excl uding from results." ); | |
| 208 | return null; | |
| 209 | } | |
| 210 | ||
| 211 | gov. va.med.ima ging.excha nge.webser vices.soap .types.v1. StudyType studyType = | |
| 212 | new go v.va.med.i maging.exc hange.webs ervices.so ap.types.v 1.StudyTyp e(); | |
| 213 | ||
| 214 | Stud yURN study URN = stud y.getStudy Urn();// S tudyURN.cr eate(study .getSiteNu mber(), st udy.getStu dyIen(), s tudy.getPa tientIcn() ); | |
| 215 | ||
| 216 | stud yType.setS tudyId( st udyURN.toS tring() ); | |
| 217 | stud yType.setD escription (study.get Descriptio n()); | |
| 218 | // stud yType.setP rocedureDa te(study.g etProcedur eDate()); | |
| 219 | stud yType.setP rocedureDa te(transla teProcedur eDateToDic om(study.g etProcedur eDate())); | |
| 220 | ||
| 221 | stud yType.setP rocedureDe scription( study.getP rocedure() ); | |
| 222 | stud yType.setP atientId(s tudy.getPa tientId()) ; | |
| 223 | stud yType.setP atientName (study.get PatientNam e()); | |
| 224 | stud yType.setS iteNumber( study.getS iteNumber( )); | |
| 225 | stud yType.setS iteAbbrevi ation(stud y.getSiteA bbr()); | |
| 226 | // stud yType.setS eriesCount (study.get SeriesCoun t()); | |
| 227 | //st udyType.se tImageCoun t(study.ge tImageCoun t()); | |
| 228 | stud yType.setS pecialtyDe scription( study.getS pecialty() ); | |
| 229 | stud yType.setR adiologyRe port(study .getRadiol ogyReport( )); | |
| 230 | stud yType.setS iteName(st udy.getSit eName()); | |
| 231 | ||
| 232 | // r eturn null for the U ID instead of the em pty string to be con sistent wi th the WSD L - DKB | |
| 233 | if ( study.getS tudyUid() != null && study.get StudyUid() .trim().le ngth() > 0 ) | |
| 234 | { | |
| 235 | studyT ype.setDic omUid(stud y.getStudy Uid()); | |
| 236 | } | |
| 237 | ||
| 238 | gov. va.med.ima ging.excha nge.webser vices.soap .types.v1. StudyTypeC omponentSe ries wrapp er = | |
| 239 | new go v.va.med.i maging.exc hange.webs ervices.so ap.types.v 1.StudyTyp eComponent Series(); | |
| 240 | ||
| 241 | gov. va.med.ima ging.excha nge.webser vices.soap .types.v1. SeriesType [] compone ntSeries = | |
| 242 | (gov.v a.med.imag ing.exchan ge.webserv ices.soap. types.v1.S eriesType[ ])transfor mSerieses( study); | |
| 243 | ||
| 244 | // J MW 7/16/08 accuratel y get the number of images by actually c ounting th e images f rom each | |
| 245 | // s eries | |
| 246 | // T his has to be done t his way be cause whil e the inte rnal count of images is now ac curate, | |
| 247 | // w e might no t give all of the in ternal ima ges throug h this int erface, th is interfa ce exclude s | |
| 248 | // a ll questio nable inte grity imag es and stu dies/image s with oth er problem s. | |
| 249 | int imageCount = 0; | |
| 250 | for( gov.va.med .imaging.e xchange.we bservices. soap.types .v1.Series Type serie s : compon entSeries) | |
| 251 | { | |
| 252 | imageC ount += se ries.getIm ageCount() ; | |
| 253 | } | |
| 254 | stud yType.setI mageCount( imageCount ); | |
| 255 | ||
| 256 | // s eries with no instan ces will b e suppress ed, so the only way to know th e correct | |
| 257 | // s eries coun t is to us e the leng th of the returned a rray - DKB | |
| 258 | stud yType.setS eriesCount (component Series.len gth); | |
| 259 | ||
| 260 | wrap per.setSer ies(compon entSeries) ; | |
| 261 | stud yType.setC omponentSe ries(wrapp er); | |
| 262 | ||
| 263 | if(s tudy.getMo dalities() != null) | |
| 264 | { | |
| 265 | String modalitie s[] = new String[stu dy.getModa lities().s ize()]; | |
| 266 | int i = 0; | |
| 267 | for(St ring modal ity : stud y.getModal ities()) | |
| 268 | { | |
| 269 | modaliti es[i] = mo dality; | |
| 270 | i++; | |
| 271 | } | |
| 272 | Modali tiesType m odalitiesT ype = new Modalities Type(modal ities); | |
| 273 | studyT ype.setMod alities(mo dalitiesTy pe); | |
| 274 | } | |
| 275 | ||
| 276 | retu rn studyTy pe; | |
| 277 | } | |
| 278 | ||
| 279 | /* (non-Java doc) | |
| 280 | * @see gov. va.med.ima ging.webse rvices.Bus inessObjec tInteprete r#transfor mImages(ja va.util.Li st) | |
| 281 | * / | |
| 282 | pu blic gov.v a.med.imag ing.exchan ge.webserv ices.soap. types.v1.S tudyType[] transform Studies(Li st<Study> studyList) | |
| 283 | th rows URNFo rmatExcept ion, Parse Exception | |
| 284 | { | |
| 285 | if(s tudyList = = null || studyList. size() == 0) | |
| 286 | return null; | |
| 287 | ||
| 288 | // n eed dynami c list bec ause not a ll interna l studies might be g iven throu gh this in terface | |
| 289 | List <gov.va.me d.imaging. exchange.w ebservices .soap.type s.v1.Study Type> vali dStudyType s = new | |
| 290 | ArrayL ist<gov.va .med.imagi ng.exchang e.webservi ces.soap.t ypes.v1.St udyType>(s tudyList.s ize()); | |
| 291 | ||
| 292 | gov. va.med.ima ging.excha nge.webser vices.soap .types.v1. StudyType[ ] result = null; | |
| 293 | ||
| 294 | for( Study stud y : studyL ist) | |
| 295 | { | |
| 296 | gov.va .med.imagi ng.exchang e.webservi ces.soap.t ypes.v1.St udyType st udyType = transformS tudy(study ); | |
| 297 | if(stu dyType != null) | |
| 298 | validStu dyTypes.ad d(studyTyp e); | |
| 299 | } | |
| 300 | ||
| 301 | resu lt = valid StudyTypes .toArray(n ew gov.va. med.imagin g.exchange .webservic es.soap.ty pes.v1.Stu dyType[val idStudyTyp es.size()] ); | |
| 302 | retu rn result; | |
| 303 | } | |
| 304 | ||
| 305 | pu blic Objec t[] transf ormSeriese s(Study st udy) | |
| 306 | th rows URNFo rmatExcept ion | |
| 307 | { | |
| 308 | Set< Series> se riesSet = study.getS eries(); | |
| 309 | if(s eriesSet = = null || seriesSet. size() == 0) | |
| 310 | return null; | |
| 311 | ||
| 312 | Arra yList<gov. va.med.ima ging.excha nge.webser vices.soap .types.v1. SeriesType > result = | |
| 313 | new Ar rayList<go v.va.med.i maging.exc hange.webs ervices.so ap.types.v 1.SeriesTy pe>(); | |
| 314 | ||
| 315 | for( Iterator<S eries> ser iesIter = seriesSet. iterator() ; seriesIt er.hasNext (); ) | |
| 316 | { | |
| 317 | Series series = seriesIter .next(); | |
| 318 | // Fil ter series with no i mages from the resul t set - DK B | |
| 319 | if (se ries.getIm ageCount() > 0) | |
| 320 | { | |
| 321 | result.a dd(transfo rmSeries(s eries, stu dy.getDesc ription()) ); | |
| 322 | } | |
| 323 | } | |
| 324 | ||
| 325 | retu rn result. toArray(ne w gov.va.m ed.imaging .exchange. webservice s.soap.typ es.v1.Seri esType[res ult.size() ]); | |
| 326 | } | |
| 327 | ||
| 328 | /* * | |
| 329 | * | |
| 330 | * @param se ries | |
| 331 | * @param se riesDescri ption | |
| 332 | * @return | |
| 333 | * @throws U RNFormatEx ception | |
| 334 | * / | |
| 335 | pu blic gov.v a.med.imag ing.exchan ge.webserv ices.soap. types.v1.S eriesType transformS eries(Seri es series, | |
| 336 | String seriesDes cription) | |
| 337 | th rows URNFo rmatExcept ion | |
| 338 | { | |
| 339 | if(s eries == n ull) | |
| 340 | return null; | |
| 341 | ||
| 342 | gov. va.med.ima ging.excha nge.webser vices.soap .types.v1. SeriesType result = | |
| 343 | new go v.va.med.i maging.exc hange.webs ervices.so ap.types.v 1.SeriesTy pe(); | |
| 344 | // n eed to ues a dynamic list beca use we mig ht not be sending al l images t hrough thi s interfac e | |
| 345 | List <gov.va.me d.imaging. exchange.w ebservices .soap.type s.v1.Insta nceType> v alidInstan ces = | |
| 346 | new Ar rayList<go v.va.med.i maging.exc hange.webs ervices.so ap.types.v 1.Instance Type>(seri es.getImag eCount()); | |
| 347 | ||
| 348 | ||
| 349 | gov. va.med.ima ging.excha nge.webser vices.soap .types.v1. InstanceTy pe[] serie sInstances = null; | |
| 350 | ||
| 351 | for( Image imag e : series ) | |
| 352 | { | |
| 353 | gov.va .med.imagi ng.exchang e.webservi ces.soap.t ypes.v1.In stanceType instanceT ype = tran sformImage (image); | |
| 354 | if(ins tanceType != null) | |
| 355 | validIns tances.add (instanceT ype); | |
| 356 | } | |
| 357 | seri esInstance s = | |
| 358 | validI nstances.t oArray(new gov.va.me d.imaging. exchange.w ebservices .soap.type s.v1.Insta nceType[va lidInstanc es.size()] ); | |
| 359 | ||
| 360 | //TO DO: retrie ve series through Vi stA if pos sible (ava ilable in DICOM txt files) | |
| 361 | resu lt.setDesc ription(se riesDescri ption); | |
| 362 | ||
| 363 | resu lt.setModa lity(serie s.getModal ity()); | |
| 364 | // r eturn null for the U ID instead of the em pty string to be con sistent wi th the WSD L - DKB | |
| 365 | if ( series.get SeriesUid( ) != null && series. getSeriesU id().trim( ).length() > 0) | |
| 366 | { | |
| 367 | result .setDicomU id(series. getSeriesU id()); | |
| 368 | } | |
| 369 | ||
| 370 | if(! "".equals( series.get SeriesNumb er())) { | |
| 371 | int se rNum = Int eger.parse Int(series .getSeries Number()); | |
| 372 | result .setDicomS eriesNumbe r(serNum); | |
| 373 | } | |
| 374 | //TO DO: do we want to ha ve a serie s URN or s hould we j ust use th e series I EN from Vi stA? | |
| 375 | resu lt.setSeri esId(serie s.getSerie sIen()); | |
| 376 | resu lt.setImag eCount(ser iesInstanc es.length) ; | |
| 377 | gov. va.med.ima ging.excha nge.webser vices.soap .types.v1. SeriesType ComponentI nstances i nstancesWr apper = | |
| 378 | new go v.va.med.i maging.exc hange.webs ervices.so ap.types.v 1.SeriesTy peComponen tInstances (); | |
| 379 | inst ancesWrapp er.setInst ance(serie sInstances ); | |
| 380 | resu lt.setComp onentInsta nces(insta ncesWrappe r); | |
| 381 | ||
| 382 | retu rn result; | |
| 383 | } | |
| 384 | ||
| 385 | /* | |
| 386 | * ========= ========== ========== ========== ========== ========== ========== ========== == | |
| 387 | * Image Tra nsforms | |
| 388 | * ========= ========== ========== ========== ========== ========== ========== ========== == | |
| 389 | * / | |
| 390 | /* (non-Java doc) | |
| 391 | * @see gov. va.med.ima ging.webse rvices.Bus inessObjec tInteprete r#transfor mImage(gov .va.med.im aging.exch ange.busin ess.Image) | |
| 392 | * / | |
| 393 | pu blic gov.v a.med.imag ing.exchan ge.webserv ices.soap. types.v1.I nstanceTyp e transfor mImage(Ima ge image) | |
| 394 | th rows Image URNFormatE xception | |
| 395 | { | |
| 396 | if(i mage == nu ll) | |
| 397 | return null; | |
| 398 | // J MW 7/17/08 - if the image has an error m essage the n don't pr ovide the image to t he DOD | |
| 399 | if(i mage.hasEr rorMessage ()) | |
| 400 | { | |
| 401 | logger .debug("Im age [" + i mage.getIe n() + "] h as error m essage, ex cluding fr om results ."); | |
| 402 | return null; | |
| 403 | } | |
| 404 | if(i mage.isDel eted()) | |
| 405 | { | |
| 406 | logger .debug("Im age [" + i mage.getIe n() +"] is deleted, excluding from resul ts."); | |
| 407 | return null; | |
| 408 | } | |
| 409 | ||
| 410 | gov. va.med.ima ging.excha nge.webser vices.soap .types.v1. InstanceTy pe instanc eType = | |
| 411 | new go v.va.med.i maging.exc hange.webs ervices.so ap.types.v 1.Instance Type(); | |
| 412 | ||
| 413 | if(i mage.getGl obalArtifa ctIdentifi er() insta nceof Imag eURN) | |
| 414 | instan ceType.set ImageUrn(i mage.getGl obalArtifa ctIdentifi er().toStr ing()); | |
| 415 | else if(image. getGlobalA rtifactIde ntifier() instanceof BhieImage URN) | |
| 416 | instan ceType.set ImageUrn( ((BhieImag eURN)image .getGlobal ArtifactId entifier() ).toString ()); | |
| 417 | else | |
| 418 | try | |
| 419 | { | |
| 420 | instance Type.setIm ageUrn( (I mageURNFac tory.creat e(image.ge tSiteNumbe r(), image .getIen(), image.get StudyIen() , image.ge tPatientId (), image. getImageMo dality(), ImageURN.c lass)).toS tring() ); | |
| 421 | } | |
| 422 | catch (URNFormat Exception x) | |
| 423 | { | |
| 424 | throw ne w ImageURN FormatExce ption(x); | |
| 425 | } | |
| 426 | ||
| 427 | // r eturn null for the U ID instead of the em pty string to be con sistent wi th the WSD L - DKB | |
| 428 | if ( image.getI mageUid()! = null && image.getI mageUid(). trim().len gth() > 0) | |
| 429 | { | |
| 430 | instan ceType.set DicomUid(i mage.getIm ageUid().t rim()); | |
| 431 | } | |
| 432 | ||
| 433 | ||
| 434 | if ( image.getD icomImageN umberForDi splay()!= null && im age.getIma geNumber() .trim().le ngth() > 0 ) | |
| 435 | { | |
| 436 | try | |
| 437 | { | |
| 438 | Integer imageNumbe r = new In teger(imag e.getImage Number()); | |
| 439 | instance Type.setDi comInstanc eNumber(im ageNumber) ; | |
| 440 | } | |
| 441 | catch (NumberFor matExcepti on ex) | |
| 442 | { | |
| 443 | // not a number - return nul l | |
| 444 | instance Type.setDi comInstanc eNumber(nu ll); | |
| 445 | } | |
| 446 | } | |
| 447 | else | |
| 448 | { | |
| 449 | instan ceType.set DicomInsta nceNumber( null); | |
| 450 | } | |
| 451 | ||
| 452 | retu rn instanc eType; | |
| 453 | } | |
| 454 | ||
| 455 | ||
| 456 | /* (non-Java doc) | |
| 457 | * @see gov. va.med.ima ging.webse rvices.Bus inessObjec tInteprete r#transfor mImages(ja va.util.Li st) | |
| 458 | * / | |
| 459 | /* | |
| 460 | pu blic gov.v a.med.imag ing.exchan ge.webserv ices.soap. types.v1.I nstanceTyp e[] transf ormImages( List<Image > imageLis t) | |
| 461 | th rows Image URNFormatE xception | |
| 462 | { | |
| 463 | if(i mageList = = null || imageList. size() == 0) | |
| 464 | return null; | |
| 465 | ||
| 466 | gov. va.med.ima ging.excha nge.webser vices.soap .types.v1. InstanceTy pe[] resul t = | |
| 467 | new go v.va.med.i maging.exc hange.webs ervices.so ap.types.v 1.Instance Type[ imag eList.size () ]; | |
| 468 | ||
| 469 | int index=0; | |
| 470 | for( Iterator<I mage> imag eIter = im ageList.it erator(); imageIter. hasNext(); ++index) | |
| 471 | result [index] = transformI mage(image Iter.next( )); | |
| 472 | ||
| 473 | ||
| 474 | retu rn result; | |
| 475 | } | |
| 476 | */ | |
| 477 | ||
| 478 | pu blic Strin g getParen tIen(Image image) | |
| 479 | { | |
| 480 | retu rn image.g etStudyIen (); | |
| 481 | } | |
| 482 | ||
| 483 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.