Changeset 2588
- Timestamp:
- 07/03/08 09:20:35 (5 months ago)
- Location:
- trunk/components
- Files:
-
- 5 added
- 1 removed
- 30 modified
-
client/.classpath (modified) (4 diffs)
-
common/.classpath (modified) (2 diffs)
-
common/src/ome/api/ICompress.java (deleted)
-
common/src/ome/api/IProjection.java (added)
-
common/src/omeis/providers/re/RenderingEngine.java (modified) (3 diffs)
-
rendering/.classpath (modified) (2 diffs)
-
rendering/src/omeis/providers/re/HSBStrategy.java (modified) (2 diffs)
-
rendering/src/omeis/providers/re/Renderer.java (modified) (4 diffs)
-
rendering/src/omeis/providers/re/RenderingStrategy.java (modified) (1 diff)
-
romio/.classpath (modified) (2 diffs)
-
romio/src/ome/io/nio/DeltaVision.java (modified) (8 diffs)
-
romio/src/ome/io/nio/DeltaVisionHeader.java (modified) (3 diffs)
-
romio/src/ome/io/nio/InMemoryPlanarPixelBuffer.java (added)
-
romio/src/ome/io/nio/PixelData.java (modified) (5 diffs)
-
romio/src/ome/io/nio/ReorderedPixelData.java (modified) (3 diffs)
-
romio/src/ome/io/nio/RomioPixelBuffer.java (modified) (8 diffs)
-
romio/test/ome/io/nio/utests/DeltaVisionTest.java (modified) (2 diffs)
-
romio/test/ome/io/nio/utests/deltavision/BasicIOUnitTest.java (modified) (3 diffs)
-
romio/test/ome/io/nio/utests/deltavision/DeltaVisionWZTUnitTest.java (modified) (5 diffs)
-
romio/test/ome/io/nio/utests/deltavision/DeltaVisionZTWUnitTest.java (modified) (5 diffs)
-
romio/test/ome/io/nio/utests/deltavision/DeltaVisionZWTUnitTest.java (modified) (5 diffs)
-
romio/test/ome/io/nio/utests/deltavision/EightBitBasicIOUnitTest.java (modified) (3 diffs)
-
romio/test/ome/io/nio/utests/deltavision/UnsignedSixteenBitBasicIOUnitTest.java (modified) (3 diffs)
-
server/.classpath (modified) (2 diffs)
-
server/resources/ome/services/service-ome.api.IProjection.xml (added)
-
server/resources/ome/services/service-omeis.providers.re.RenderingEngine.xml (modified) (1 diff)
-
server/src/ome/api/local/LocalCompress.java (modified) (1 diff)
-
server/src/ome/logic/AWTScaleService.java (modified) (2 diffs)
-
server/src/ome/logic/CompressImpl.java (modified) (1 diff)
-
server/src/ome/logic/PixelsImpl.java (modified) (1 diff)
-
server/src/ome/logic/RenderingSettingsImpl.java (modified) (4 diffs)
-
server/src/ome/services/RawPixelsBean.java (modified) (2 diffs)
-
server/src/ome/services/RenderingBean.java (modified) (11 diffs)
-
server/src/ome/services/ThumbnailBean.java (modified) (1 diff)
-
server/src/ome/services/projection (added)
-
server/src/ome/services/projection/ProjectionBean.java (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/components/client/.classpath
r2263 r2588 9 9 <classpathentry kind="lib" path="target/libs/ant.jar"/> 10 10 <classpathentry kind="lib" path="target/libs/antlr.jar"/> 11 <classpathentry kind="lib" path="target/libs/asm.jar"/>12 <classpathentry kind="lib" path="target/libs/asm-attrs.jar"/>13 <classpathentry kind="lib" path="target/libs/cglib.jar"/>14 11 <classpathentry kind="lib" path="target/libs/checkstyle.jar"/> 15 12 <classpathentry kind="lib" path="target/libs/common.jar"/> … … 17 14 <classpathentry kind="lib" path="target/libs/commons-collections.jar"/> 18 15 <classpathentry kind="lib" path="target/libs/commons-logging.jar"/> 19 <classpathentry kind="lib" path="target/libs/dom4j.jar"/>20 16 <classpathentry kind="lib" path="target/libs/dsl.jar"/> 21 <classpathentry kind="lib" path="target/libs/ehcache.jar"/>22 17 <classpathentry kind="lib" path="target/libs/emma_ant.jar"/> 23 18 <classpathentry kind="lib" path="target/libs/emma.jar"/> … … 25 20 <classpathentry kind="lib" path="target/libs/freemarker.jar"/> 26 21 <classpathentry kind="lib" path="target/libs/groovy.jar"/> 27 <classpathentry kind="lib" path="target/libs/hibernate.jar"/>28 22 <classpathentry kind="lib" path="target/libs/hibernate-annotations.jar"/> 29 23 <classpathentry kind="lib" path="target/libs/hibernate-commons-annotations.jar"/> … … 43 37 <classpathentry kind="lib" path="target/libs/persistence-api.jar"/> 44 38 <classpathentry kind="lib" path="target/libs/postgresql.jar"/> 45 <classpathentry kind="lib" path="target/libs/qdox.jar"/>46 39 <classpathentry kind="lib" path="target/libs/spring.jar"/> 47 40 <classpathentry kind="lib" path="target/libs/spring-mock.jar"/> -
trunk/components/common/.classpath
r2019 r2588 18 18 <classpathentry kind="lib" path="target/libs/dom4j.jar"/> 19 19 <classpathentry kind="lib" path="target/libs/dsl.jar"/> 20 <classpathentry kind="lib" path="target/libs/ehcache.jar"/>21 20 <classpathentry kind="lib" path="target/libs/emma_ant.jar"/> 22 21 <classpathentry kind="lib" path="target/libs/emma.jar"/> … … 41 40 <classpathentry kind="lib" path="target/libs/persistence-api.jar"/> 42 41 <classpathentry kind="lib" path="target/libs/postgresql.jar"/> 43 <classpathentry kind="lib" path="target/libs/qdox.jar"/>44 42 <classpathentry kind="lib" path="target/libs/spring.jar"/> 45 43 <classpathentry kind="lib" path="target/libs/spring-mock.jar"/> -
trunk/components/common/src/omeis/providers/re/RenderingEngine.java
r2344 r2588 78 78 * If <code>pd</code> is <code>null</code>. 79 79 */ 80 public RGBBuffer render(PlaneDef pd) throws ValidationException;80 public RGBBuffer render(PlaneDef pd); 81 81 82 82 /** … … 95 95 * @see render() 96 96 */ 97 public int[] renderAsPackedInt(PlaneDef pd) throws ValidationException;97 public int[] renderAsPackedInt(PlaneDef pd); 98 98 99 99 /** … … 110 110 * @see renderAsPackedInt() 111 111 */ 112 public byte[] renderCompressed(PlaneDef pd) throws ValidationException; 112 public byte[] renderCompressed(PlaneDef pd); 113 114 115 /** 116 * Performs a projection through selected optical sections of a particular 117 * timepoint with the currently active channels and renders the data for 118 * display. 119 * @param algorithm {@link IProjection#MAXIMUM_INTENSITY}, 120 * {@link IProjection#MEAN_INTENSITY} or {@link IProjection#SUM_INTENSITY}. 121 * @param stepping Stepping value to use while calculating the projection. 122 * For example, <code>stepping=1</code> will use every optical section from 123 * <code>start</code> to <code>end</code> where <code>stepping=2</code> will 124 * use every other section from <code>start</code> to <code>end</code> to 125 * perform the projection. 126 * @param start Optical section to start projecting from. 127 * @param end Optical section to finish projecting. 128 * @return A packed-integer <i>RGBA</i> rendered image of the projected 129 * pixels. 130 * @throws ValidationException Where: 131 * <ul> 132 * <li><code>algorithm</code> is unknown</li> 133 * <li><code>timepoint</code> is out of range</li> 134 * <li><code>start</code> is out of range</li> 135 * <li><code>end</code> is out of range</li> 136 * <li><code>start > end</code></li> 137 * </ul> 138 * @see IPixels#projectPixels() 139 */ 140 public int[] renderProjectedAsPackedInt(int algorithm, int timepoint, 141 int stepping, int start, int end); 142 143 /** 144 * Performs a projection through selected optical sections of a particular 145 * timepoint with the currently active channels, renders the data for 146 * display and compresses the resulting RGBA composite image. 147 * @param algorithm {@link IProjection#MAXIMUM_INTENSITY}, 148 * {@link IProjection#MEAN_INTENSITY} or {@link IProjection#SUM_INTENSITY}. 149 * @param stepping Stepping value to use while calculating the projection. 150 * For example, <code>stepping=1</code> will use every optical section from 151 * <code>start</code> to <code>end</code> where <code>stepping=2</code> will 152 * use every other section from <code>start</code> to <code>end</code> to 153 * perform the projection. 154 * @param start Optical section to start projecting from. 155 * @param end Optical section to finish projecting. 156 * @return A compressed <i>RGBA</i> rendered JPEG image of the projected 157 * pixels. 158 * @throws ValidationException Where: 159 * <ul> 160 * <li><code>algorithm</code> is unknown</li> 161 * <li><code>timepoint</code> is out of range</li> 162 * <li><code>start</code> is out of range</li> 163 * <li><code>end</code> is out of range</li> 164 * <li><code>start > end</code></li> 165 * </ul> 166 * @see IPixels#projectPixels() 167 */ 168 public byte[] renderProjectedCompressed(int algorithm, int timepoint, 169 int stepping, int start, int end); 113 170 114 171 /** -
trunk/components/rendering/.classpath
r2019 r2588 19 19 <classpathentry kind="lib" path="target/libs/dom4j.jar"/> 20 20 <classpathentry kind="lib" path="target/libs/dsl.jar"/> 21 <classpathentry kind="lib" path="target/libs/ehcache.jar"/>22 21 <classpathentry kind="lib" path="target/libs/emma_ant.jar"/> 23 22 <classpathentry kind="lib" path="target/libs/emma.jar"/> … … 42 41 <classpathentry kind="lib" path="target/libs/persistence-api.jar"/> 43 42 <classpathentry kind="lib" path="target/libs/postgresql.jar"/> 44 <classpathentry kind="lib" path="target/libs/qdox.jar"/>45 43 <classpathentry kind="lib" path="target/libs/romio.jar"/> 46 44 <classpathentry kind="lib" path="target/libs/spring.jar"/> -
trunk/components/rendering/src/omeis/providers/re/HSBStrategy.java
r1894 r2588 42 42 * Transforms a plane within a given pixels set into an <i>RGB</i> image. As 43 43 * many wavelengths (channels) as desired can contribute to the final image and 44 * each wavelength is mapped to a color. All th isthings are specified by the44 * each wavelength is mapped to a color. All these things are specified by the 45 45 * rendering context. 46 46 * <p> 47 * When multiple wavelengths have to be combined into the final image (this is 48 * the case if the rendering context specifies more than one active channel), 49 * this strategy renders each wavelength in a separate thread — this often 50 * results in parallel rendering on multi-processor machines. 47 * This strategy renders the in "regions", dividing the planar data up based 48 * on {@link #maxTasks} and assigning each task to its own thread. This should 49 * result in parallel rendering on multi-processor machines. 51 50 * </p> 52 51 * <p> 53 52 * Thread-safety relies on the fact that the rendering context is not going to 54 * change during the whole image rendering process. (This is enforced by the 55 * {@link RenderingEngineImpl}; in fact, while the <code>render</code> method 56 * executes, the whole component is locked.) 53 * change during the whole image rendering process and that each task is 54 * working on its own atomic unit of work. 57 55 * </p> 58 56 * … … 261 259 * Implemented as specified by the superclass. 262 260 * 263 * @see RenderingStrategy#render (Renderer ctx, PlaneDef planeDef)261 * @see RenderingStrategy#renderAsPackedInt(Renderer ctx, PlaneDef planeDef) 264 262 */ 265 263 @Override -
trunk/components/rendering/src/omeis/providers/re/Renderer.java
r2344 r2588 20 20 // Application-internal dependencies 21 21 import ome.conditions.ResourceError; 22 import ome.conditions.ValidationException; 22 23 import ome.io.nio.PixelBuffer; 23 24 import ome.model.core.Channel; … … 422 423 * Selects a plane orthogonal to one of the <i>X</i>, <i>Y</i>, 423 424 * or <i>Z</i> axes. 425 * @param newBuffer 426 * The pixel buffer to use in place of the one currently 427 * defined in the renderer. This will not change the state 428 * of the Renderer. If <code>null</code> is passed the existing 429 * pixel buffer will be used. 424 430 * @return An <i>RGB</i> image ready to be displayed on screen. 425 431 * @throws IOException 426 * If an error occur ed while trying to pull out data from the432 * If an error occurred while trying to pull out data from the 427 433 * pixels data repository. 428 434 * @throws QuantizationException … … 431 437 * If <code>pd</code> is <code>null</code>. 432 438 */ 433 public int[] renderAsPackedInt(PlaneDef pd) throws IOException, 434 QuantizationException { 439 public int[] renderAsPackedInt(PlaneDef pd, PixelBuffer newBuffer) 440 throws IOException, QuantizationException 441 { 435 442 if (pd == null) { 436 443 throw new NullPointerException("No plane definition."); … … 439 446 log.info("Using: '" + renderingStrategy.getClass().getName() 440 447 + "' rendering strategy."); 441 RGBIntBuffer img = renderingStrategy.renderAsPackedInt(this, pd); 442 stats.stop(); 443 // TODO: Commenting this out for now. -- callan 444 //log.info(stats.getStats()); 445 return img.getDataBuffer(); 446 } 447 448 PixelBuffer oldBuffer = buffer; 449 try 450 { 451 if (newBuffer != null) 452 { 453 buffer = newBuffer; 454 } 455 RGBIntBuffer img = renderingStrategy.renderAsPackedInt(this, pd); 456 stats.stop(); 457 // TODO: Commenting this out for now. -- callan 458 //log.info(stats.getStats()); 459 return img.getDataBuffer(); 460 } 461 finally 462 { 463 buffer = oldBuffer; 464 } 465 } 466 448 467 /** 449 468 * Returns the size, in bytes, of the {@link RGBBuffer} that would be -
trunk/components/rendering/src/omeis/providers/re/RenderingStrategy.java
r1739 r2588 124 124 * Encapsulates a specific rendering algorithm. The image is rendered 125 125 * according to the current settings hold by the <code>ctx</code> 126 * argument. Typically, active waveleng hts are processed by first quantizing127 * the waveleng htdata in the plane selected by <code>pd</code> — the126 * argument. Typically, active wavelengths are processed by first quantizing 127 * the wavelength data in the plane selected by <code>pd</code> — the 128 128 * quantum strategy is retrieved from the {@link QuantumManager} (accessed 129 129 * through the <code>ctx</code> object) and the actual data from the -
trunk/components/romio/.classpath
r2019 r2588 19 19 <classpathentry kind="lib" path="target/libs/dom4j.jar"/> 20 20 <classpathentry kind="lib" path="target/libs/dsl.jar"/> 21 <classpathentry kind="lib" path="target/libs/ehcache.jar"/>22 21 <classpathentry kind="lib" path="target/libs/emma_ant.jar"/> 23 22 <classpathentry kind="lib" path="target/libs/emma.jar"/> … … 42 41 <classpathentry kind="lib" path="target/libs/persistence-api.jar"/> 43 42 <classpathentry kind="lib" path="target/libs/postgresql.jar"/> 44 <classpathentry kind="lib" path="target/libs/qdox.jar"/>45 43 <classpathentry kind="lib" path="target/libs/spring.jar"/> 46 44 <classpathentry kind="lib" path="target/libs/spring-mock.jar"/> -
trunk/components/romio/src/ome/io/nio/DeltaVision.java
r1937 r2588 11 11 import java.io.IOException; 12 12 import java.io.RandomAccessFile; 13 import java.nio.Buffer;14 13 import java.nio.ByteBuffer; 15 14 import java.nio.ByteOrder; 16 15 import java.nio.IntBuffer; 17 import java.nio.MappedByteBuffer;18 16 import java.nio.ShortBuffer; 19 17 import java.nio.channels.FileChannel; … … 52 50 private Integer totalSize; 53 51 54 protected MappedByteBuffer buf;52 protected ByteBuffer buf; 55 53 56 54 private OriginalFile originalFile; … … 94 92 for (int t = 0; t < getSizeT(); t++) { 95 93 try { 96 MappedByteBuffer buffer = getTimepoint(t).getData();94 ByteBuffer buffer = getTimepoint(t).getData(); 97 95 md.update(buffer); 98 96 } catch (DimensionsOutOfBoundsException e) { … … 132 130 if (buffer.length != count * header.getBytesPerPixel()) 133 131 throw new ApiUsageException("Buffer size incorrect."); 134 MappedByteBuffer plane = getPlane(z, c, t).getData();132 ByteBuffer plane = getPlane(z, c, t).getData(); 135 133 swapAndReorderIfRequired(plane, ByteBuffer.wrap(buffer), offset, count); 136 134 return buffer; … … 157 155 if (buffer.length != getPlaneSize()) 158 156 throw new ApiUsageException("Buffer size incorrect."); 159 MappedByteBuffer b = getPlane(z, c, t).getData();157 ByteBuffer b = getPlane(z, c, t).getData(); 160 158 swapAndReorderIfRequired(b, ByteBuffer.wrap(buffer), 161 159 0, getSizeX() * getSizeY()); … … 192 190 throws IOException { 193 191 FileChannel fileChannel = getFileChannel(); 194 MappedByteBuffer buf = fileChannel.map(MapMode.READ_ONLY, offset, size);192 ByteBuffer buf = fileChannel.map(MapMode.READ_ONLY, offset, size); 195 193 if (!header.isNative()) 196 194 buf.order(ByteOrder.LITTLE_ENDIAN); … … 206 204 if (buffer.length != size) 207 205 throw new ApiUsageException("Buffer size incorrect."); 208 MappedByteBuffer b = getRegion(size, offset).getData();206 ByteBuffer b = getRegion(size, offset).getData(); 209 207 b.get(buffer); 210 208 return buffer; … … 230 228 if (buffer.length != getRowSize()) 231 229 throw new ApiUsageException("Buffer size incorrect."); 232 MappedByteBuffer b = getRow(y, z, c, t).getData();230 ByteBuffer b = getRow(y, z, c, t).getData(); 233 231 swapAndReorderIfRequired(b, ByteBuffer.wrap(buffer), 0, getSizeX()); 234 232 return buffer; -
trunk/components/romio/src/ome/io/nio/DeltaVisionHeader.java
r1906 r2588 1 1 package ome.io.nio; 2 2 3 import java.nio.ByteBuffer; 3 4 import java.nio.ByteOrder; 4 5 import java.nio.MappedByteBuffer; … … 21 22 public class DeltaVisionHeader { 22 23 23 private MappedByteBuffer data;24 private ByteBuffer data; 24 25 25 26 /** … … 105 106 * @param endian 106 107 */ 107 public DeltaVisionHeader( MappedByteBuffer data, boolean endian) {108 public DeltaVisionHeader(ByteBuffer data, boolean endian) { 108 109 this.data = data; 109 110 -
trunk/components/romio/src/ome/io/nio/PixelData.java
r1860 r2588 9 9 10 10 import java.nio.ByteOrder; 11 import java.nio. MappedByteBuffer;11 import java.nio.ByteBuffer; 12 12 13 13 import ome.model.enums.PixelsType; … … 46 46 47 47 /** The pixels data backing buffer. */ 48 protected MappedByteBuffer data;48 protected ByteBuffer data; 49 49 50 50 /** If the data is signed. */ … … 63 63 * @param data The raw pixel data. 64 64 */ 65 public PixelData(PixelsType pixelsType, MappedByteBuffer data)65 public PixelData(PixelsType pixelsType, ByteBuffer data) 66 66 { 67 67 this.data = data; … … 150 150 return true; 151 151 return false; 152 } 153 154 /** 155 * Sets the pixel intensity value of the pixel at a given offset within 156 * the backing buffer. This method takes into account bytes per pixel. 157 * 158 * @param offset The relative offset (taking into account the number of 159 * bytes per pixel) within the backing buffer. 160 * @param value Pixel value to set. 161 */ 162 public void setPixelValue(int offset, double value) 163 { 164 setPixelValueDirect(offset * bytesPerPixel, value); 165 } 166 167 /** 168 * Sets the pixel intensity value of the pixel at a given offset within 169 * the backing buffer. This method does not take into account bytes per 170 * pixel. 171 * 172 * @param offset The absolute offset within the backing buffer. 173 * @param value Pixel value to set. 174 */ 175 public void setPixelValueDirect(int offset, double value) 176 { 177 switch (javaType) 178 { 179 case BYTE: 180 data.put(offset, (byte) value); 181 break; 182 case SHORT: 183 data.putShort(offset, (short) value); 184 break; 185 case INT: 186 data.putInt(offset, (int) value); 187 break; 188 case FLOAT: 189 data.putFloat(offset, (float) value); 190 break; 191 case DOUBLE: 192 data.putDouble(offset, value); 193 break; 194 } 152 195 } 153 196 … … 212 255 * @return See above. 213 256 */ 214 public MappedByteBuffer getData()257 public ByteBuffer getData() 215 258 { 216 259 return data; -
trunk/components/romio/src/ome/io/nio/ReorderedPixelData.java
r1906 r2588 9 9 10 10 import java.nio.ByteOrder; 11 import java.nio. MappedByteBuffer;11 import java.nio.ByteBuffer; 12 12 13 13 import ome.conditions.ApiUsageException; … … 38 38 * @param rowSize The size of each pixels row in bytes. 39 39 */ 40 public ReorderedPixelData(PixelsType pixelsType, MappedByteBuffer data,40 public ReorderedPixelData(PixelsType pixelsType, ByteBuffer data, 41 41 int rowSize) 42 42 { … … 82 82 * @return See above. 83 83 */ 84 public MappedByteBuffer getData()84 public ByteBuffer getData() 85 85 { 86 86 return data; -
trunk/components/romio/src/ome/io/nio/RomioPixelBuffer.java
r1891 r2588 210 210 if (buffer.length != size) 211 211 throw new ApiUsageException("Buffer size incorrect."); 212 MappedByteBuffer b = getRegion(size, offset).getData();212 ByteBuffer b = getRegion(size, offset).getData(); 213 213 b.get(buffer); 214 214 return buffer; … … 228 228 if (buffer.length != getRowSize()) 229 229 throw new ApiUsageException("Buffer size incorrect."); 230 MappedByteBuffer b = getRow(y, z, c, t).getData();230 ByteBuffer b = getRow(y, z, c, t).getData(); 231 231 b.get(buffer); 232 232 return buffer;
