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 | LinearWindowLevel.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 | LinearWindowLevel.java | Mon Dec 4 22:00:52 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 348 |
| 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.hi5 .client; | |
| 5 | ||
| 6 | import org .apache.lo gging.log4 j.LogManag er; | |
| 7 | import org .apache.lo gging.log4 j.Logger; | |
| 8 | ||
| 9 | import com .google.gw t.canvas.d om.client. CanvasPixe lArray; | |
| 10 | import com .google.gw t.touch.cl ient.Point ; | |
| 11 | ||
| 12 | /** | |
| 13 | * @author
|
|
| 14 | * | |
| 15 | */ | |
| 16 | public cla ss LinearW indowLevel | |
| 17 | { | |
| 18 | privat e Logger l ogger = Lo gManager.g etLogger(" LinearWind owLevel"); | |
| 19 | ||
| 20 | privat e final Im ageStatist ics imageS tats; | |
| 21 | privat e final Af fineTransf orm affine Transform; | |
| 22 | privat e final Pi xelTransfo rm pixelTr ansform; | |
| 23 | privat e double l evel; | |
| 24 | privat e double w indow; | |
| 25 | ||
| 26 | public LinearWin dowLevel(I mageStatis tics image Stats, Aff ineTransfo rm affineT ransform, PixelTrans form pixel Transform) | |
| 27 | { | |
| 28 | th is.imageSt ats = imag eStats; | |
| 29 | th is.affineT ransform = affineTra nsform; | |
| 30 | th is.pixelTr ansform = pixelTrans form; | |
| 31 | ||
| 32 | th is.setLeve l(imageSta ts.getLeve l()); | |
| 33 | th is.setWind ow(imageSt ats.getWin dow()); | |
| 34 | } | |
| 35 | ||
| 36 | public ImageStat istics get ImageStats () | |
| 37 | { | |
| 38 | re turn image Stats; | |
| 39 | } | |
| 40 | ||
| 41 | public AffineTra nsform get AffineTran sform() | |
| 42 | { | |
| 43 | re turn affin eTransform ; | |
| 44 | } | |
| 45 | ||
| 46 | public PixelTran sform getP ixelTransf orm() | |
| 47 | { | |
| 48 | re turn pixel Transform; | |
| 49 | } | |
| 50 | ||
| 51 | public double ge tLevel() | |
| 52 | { | |
| 53 | re turn level ; | |
| 54 | } | |
| 55 | ||
| 56 | public void setL evel(doubl e level) | |
| 57 | { | |
| 58 | if (level < 0 .0) | |
| 59 | this.lev el = 0.0; | |
| 60 | el se if(leve l > getIma geStats(). getMaximum ()) | |
| 61 | this.lev el = getIm ageStats() .getMaximu m(); | |
| 62 | el se | |
| 63 | this.lev el = level ; | |
| 64 | } | |
| 65 | ||
| 66 | public double ge tWindow() | |
| 67 | { | |
| 68 | re turn windo w; | |
| 69 | } | |
| 70 | ||
| 71 | public void setW indow(doub le window) | |
| 72 | { | |
| 73 | if (window < 1.0) | |
| 74 | this.win dow = 1.0; | |
| 75 | el se if(wind ow > getIm ageStats() .getMaximu mWindow()) | |
| 76 | this.win dow = getI mageStats( ).getMaxim umWindow() ; | |
| 77 | el se | |
| 78 | this.win dow = wind ow; | |
| 79 | } | |
| 80 | ||
| 81 | /** | |
| 82 | * | |
| 83 | * @pa ram contex t | |
| 84 | * @pa ram width | |
| 85 | * @pa ram height | |
| 86 | * @pa ram pixelD ata | |
| 87 | */ | |
| 88 | public void load CanvasPixe lArray( in t[] pixelD ata, doubl e width, d ouble heig ht, Canvas PixelArray cpa) | |
| 89 | { | |
| 90 | do uble bucke tSize = ge tWindow() / getImage Stats().ge tDisplayGr ayScaleLev els(); | |
| 91 | do uble minWi ndowValue = getLevel () - (getW indow() / 2.0); | |
| 92 | do uble maxWi ndowValue = minWindo wValue + g etWindow() ; | |
| 93 | lo gger.info( "start loa dContext [ " + getLev el() + "-" + getWind ow() + "] " + bucket Size); | |
| 94 | ||
| 95 | fo r (int y = 0; y < he ight; ++y) | |
| 96 | { | |
| 97 | int rowO ffset = y * (int)wid th; | |
| 98 | //String Builder ro wDataMsg = new Strin gBuilder(" Row: " + y + " "); | |
| 99 | ||
| 100 | for (int x = 0; x < width; + +x) | |
| 101 | { | |
| 102 | doub le pixelVa lue = pixe lData[rowO ffset + x] ; | |
| 103 | ||
| 104 | int value = 0; | |
| 105 | if(p ixelValue > maxWindo wValue) | |
| 106 | value = 25 5; | |
| 107 | else if(pixelV alue < min WindowValu e) | |
| 108 | value = 0; | |
| 109 | else | |
| 110 | value = (i nt)((pixel Value - mi nWindowVal ue) / buck etSize); | |
| 111 | //ro wDataMsg.a ppend(Inte ger.toHexS tring(pixe lValue) + " ->" + In teger.toHe xString(va lue) + ", "); | |
| 112 | ||
| 113 | // D o any pixe l transfor mation req uired (e.g . invert) | |
| 114 | // P ixel trans formations change pi xel values but not p osition in the image . | |
| 115 | RGBP ixel origi nPixel = n ew RGBPixe l(value, v alue, valu e); | |
| 116 | RGBP ixel trans formedPixe l = getPix elTransfor m().transf ormPixel(o riginPixel ); | |
| 117 | ||
| 118 | // D o the affi ne transfo rmation re quested. | |
| 119 | // T his maps t he origin point to t he destina tion image point and could inc lude | |
| 120 | // r otation an d flipping . | |
| 121 | Poin t originPo int = new Point(x - (width /2 ), y - (he ight / 2)) ; / / the orig in is a do uble array , one doub le per pix el | |
| 122 | Poin t destPoin t = getAff ineTransfo rm().trans formPoint( originPoin t); | |
| 123 | int destOffset = getAffi neTransfor m().destin ationCPAPi xelOffset( destPoint) ; | |
| 124 | ||
| 125 | tran sformedPix el.setValu eIn(cpa, d estOffset) ; | |
| 126 | } | |
| 127 | //logger .info(rowD ataMsg.toS tring()); | |
| 128 | } | |
| 129 | lo gger.info( "stop load Context [" + getLeve l() + "-" + getWindo w() + "] " + bucketS ize); | |
| 130 | } | |
| 131 | ||
| 132 | /** | |
| 133 | * | |
| 134 | * @pa ram pixelD ata | |
| 135 | */ | |
| 136 | public static Im ageStatist ics analyz e(int widt h, int hei ght, int g rayScaleLe vels, int displayGra yScaleLeve ls, int[] pixelData) | |
| 137 | { | |
| 138 | in t histogra mBucketCou nt = grayS caleLevels / display GrayScaleL evels; | |
| 139 | in t[] histog ram = new int[histog ramBucketC ount]; | |
| 140 | fo r(int inde x=0; index <histogram BucketCoun t; ++index ) | |
| 141 | histogra m[index] = 0; | |
| 142 | ||
| 143 | do uble minim um = Doubl e.MAX_VALU E; | |
| 144 | do uble maxim um = Doubl e.MIN_VALU E; | |
| 145 | do uble windo w = 0.0; | |
| 146 | do uble level = 0.0; | |
| 147 | ||
| 148 | fo r(int pixe l : pixelD ata) | |
| 149 | { | |
| 150 | if(pixel > maximum ) maximum = pixel; | |
| 151 | if(pixel < minimum ) minimum = pixel; | |
| 152 | ++histog ram[pixel / displayG rayScaleLe vels]; | |
| 153 | } | |
| 154 | ||
| 155 | St ringBuilde r sb = new StringBui lder("Hist ogram data ["); | |
| 156 | fo r(int inde x=0; index <histogram BucketCoun t; ++index ) | |
| 157 | sb.appen d( histogr am[index] + ","); | |
| 158 | ||
| 159 | sb .append("] "); | |
| 160 | ||
| 161 | wi ndow = (ma ximum - mi nimum) / 4 ; | |
| 162 | ||
| 163 | le vel = ((ma ximum - mi nimum) / 2 ) + minimu m; | |
| 164 | ||
| 165 | Im ageStatist ics imageS tats = new ImageStat istics( | |
| 166 | width, h eight, | |
| 167 | grayScal eLevels, d isplayGray ScaleLevel s, | |
| 168 | window, level, | |
| 169 | maximum, minimum, | |
| 170 | histogra m); | |
| 171 | ||
| 172 | re turn image Stats; | |
| 173 | } | |
| 174 | ||
| 175 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.