-
Notifications
You must be signed in to change notification settings - Fork 37
Null Operation
The "Null" operator is a simple operator which takes an input image and returns it without doing any processing. This kind of operations is helpful when a property, or a renderingHint object must be set to the source image, like the TileCache hints. This operation is almost equal to that of the JAI package but with the possibility to provide an image to the operationDescriptor directly. NoData and ROI are not handled.
WORKFLOW:
- creation of the NullOpImage.java class and the associated descriptor and RenderedImageFactory.
- testing of the Null operation.
The classes composing this module are:
- NullOpImage.java : this class "executes" the Null operation.
- NullDescriptor.java : this class describes the parameters and features of the Null operation.
- NullCRIF.java : this class is a RenderedImageFactory called by JAI with the JAI.create() method.
The NullOpImage class simply takes the source image and returns the associated tiles. If a TileCache is used, then the NullOpImage can store in cache each source image tile requested. Other 2 utility methods are get/set Properties()/Property() used for changing the image properties.
The NullDescriptor class simply describes which values must be passed to the Null operation and returns a new instance of the NullOpImage by calling the create() method. NullCRIF class is the RenderedImageFactory associated to the Null operation and then returns the image requested by the JAI create() method.
A simple pseudo-code used for better undestanding the null operation:
// destTile= destination image tile.
// sourceImage= source image.
// minTileY,maxTileY = source image tiles indexes on the X axis.
// minTileY,maxTileY = source image tiles indexes on the Y axis.
for(int x = minTileX; x<maxTileX;x++){
for(int y = minTileY; y<maxTileY;y++){
destTile = sourceImage.getTile(x,y);
}
}
The test-classes used for checking the features of the Null operation are:
- NullOpTest.java
- ComparisonTest.java
The first class tests if the destination image is equal to the source image. This purpose is achieved by executing the Null operation and then comparing the pixels of the first tile of the 2 images. The operation is repeated for all the JAI data types.
The second class is used for evaluating the performances of the two null operators(this version and the JAI one). This test is made by executing the Null operation with one of the two NullDescriptor and saving the mean, maximum and minimum computation time. At the end of every cycle the JAI TileCache is flushed so that all the image tiles must be recalculated. The average, maximum and minimum computation times are not saved for all the iterations, because the first N iterations are not considered due to the Java HotSpot compilation. The number of the iterations to consider and not can be set by passing respectively these 2 Integer parameters to the JVM: JAI.Ext.BenchmarkCycles and JAI.Ext.NotBenchmarkCycles. For selecting which of the 2 descriptor associated to the operation must be tested, the JAI.Ext.OldDescriptor JVM parameter must be set to true or false(true for the old descriptor and false for the new one); the JVM parameter JAI.Ext.TestSelector can be from 0 to 5 and indicates the image data type. The computation times are print to the screen at the end of the process.