Hi Ede, It is such an euphemism to refer to big files with org.openjump.core.rasterimage framework as it takes a quite long time to load big files. Anyhow I did some tests, using basically TIFF files with no compression of different color depth: the memory usually increases than goes back at the same level when I activate RasterImageLayerpropertiesPlugin (the one which mostly use that modification in the source). I did not recognize differences on OpenJUMP before and after this modification. On the other hand I can load on OJ TIFF file not bigger that 100Mb-150Mb, than org.openjump.core.rasterimage framework fails - I mostly have errors on calculate statistics of the file, class GDALPamDataset, or on RasterImageLayer.loadfile. So I can not evaluate bigger files. On the other hand: a) org.openjump.core.rasterimage is basically used to load files which in turn are analysed using Sextante toolbox (or OpenKLEM). The few tools which are embedded on OJ (and to be used on RasterImageLayers, see Raster menu) are basically enhanced versions of Sextante and OpenKLEM. Since all these tools are specifically for DEM analysis, users use org.openjump.core.rasterimage framework to load single band raster files, including TIFF. And these files are usually small b) if I want to display a color TIFF map I will use ReferencedImage framework, it if far longer better than RasterImageLayer framework as to load and display TIFF in a shorter time and lesser memory. All ReferenceImageLayer (JAI, ImageIO and GeoSolutions) seems to load files which are not possible to load with RasterImageLayer framework. c) considering point b), sometimes it is frustrating to work with DEM as RasterImageLayer framework seems to fail with some types of TIF, like Aster DEM which are quite useful, or (as I discovered recently) with some TIFF made using QGIS. I still don't know if the effect of the libraries, of the way TIFF RasterImageLayer framework works (in some files it uses ImageIO in other JAI.
I thought the problem was on JAI, but now I am not sure. One day I would like to explore com.vividsolutions.jump.workbench.imagery, some of the implements have getEnvelope and getImage method which is basically what RasterImageLayer needs. But this is a job for the future ;-) Peppe I did a quick test using Il giorno ven 28 ago 2020 alle ore 16:43 <edgar.sol...@web.de> ha scritto: > hey Peppe, > > hmm these changes create a copy of the image in memory. can you check with > a really big file that this does not "explode" in memory? ..ede > > On 8/27/2020 10:07 AM, jump-pilot-svn--- via Jump-pilot-devel wrote: > > Revision: 6391 > > http://sourceforge.net/p/jump-pilot/code/6391 > > Author: ma15569 > > Date: 2020-08-27 08:07:43 +0000 (Thu, 27 Aug 2020) > > Log Message: > > ----------- > > Workaround to read color depth and DPI from Aster dem files. Previous > methods (based on JAI) seem to fail with 32DPI/ 4bpp tiff files > > > > Modified Paths: > > -------------- > > > > core/trunk/src/org/openjump/core/ui/plugin/raster/RasterImageLayerPropertiesPlugIn.java > > > > Modified: > core/trunk/src/org/openjump/core/ui/plugin/raster/RasterImageLayerPropertiesPlugIn.java > > =================================================================== > > --- > core/trunk/src/org/openjump/core/ui/plugin/raster/RasterImageLayerPropertiesPlugIn.java > 2020-08-26 16:02:28 UTC (rev 6390) > > +++ > core/trunk/src/org/openjump/core/ui/plugin/raster/RasterImageLayerPropertiesPlugIn.java > 2020-08-27 08:07:43 UTC (rev 6391) > > @@ -4,6 +4,7 @@ > > import java.awt.Dimension; > > import java.awt.GridBagLayout; > > import java.awt.event.ActionEvent; > > +import java.awt.image.BufferedImage; > > import java.awt.image.ColorModel; > > import java.awt.image.DataBuffer; > > import java.awt.image.Raster; > > @@ -16,7 +17,7 @@ > > import java.util.Hashtable; > > import java.util.Locale; > > > > -import javax.media.jai.PlanarImage; > > +//import javax.media.jai.PlanarImage; > > import javax.swing.BorderFactory; > > import javax.swing.Box; > > import javax.swing.Icon; > > @@ -442,9 +443,10 @@ > > raster_bands = df.format(rLayer.getNumBands());// Get raster > number of > > // bands > > Raster raster = rLayer.getRasterData(null); > > + BufferedImage bImage = rLayer.getImage(); > > raster_datatype = getDataType(raster); // Get raster data type > > - raster_colordepth = getColorDepth(raster); // Get raster color > depth > > - raster_dpi = getDPI(raster); // Get raster DPI > > + raster_colordepth = getColorDepth(bImage); // Get raster color > depth > > + raster_dpi = getDPI(bImage); // Get raster DPI > > extent = rLayer.getWholeImageEnvelope(); // Get Envelope > > extent_cellSizeX = df.format(cellSizeX(raster, extent));// Get > X Cell > > // size > > @@ -616,22 +618,33 @@ > > /* > > * Gets color depth > > */ > > - public String getColorDepth(Raster r) throws IOException { > > + /* public String getColorDepth(Raster r) throws IOException { > > SampleModel sm = r.getSampleModel(); > > ColorModel cm = PlanarImage.createColorModel(sm); > > int colordepth = cm.getNumComponents(); > > return String.valueOf(colordepth) + " bpp"; > > - } > > + }*/ > > + public String getColorDepth(BufferedImage r) throws IOException { > > > > + ColorModel cm = r.getColorModel(); > > + int colordepth = cm.getNumComponents(); > > + return String.valueOf(colordepth) + " bpp"; > > + } > > + > > /* > > * Gets Dots per Inch (DPI) > > */ > > - public String getDPI(Raster r) throws IOException { > > + /* public String getDPI(Raster r) throws IOException { > > SampleModel sm = r.getSampleModel(); > > ColorModel cm = PlanarImage.createColorModel(sm); > > return String.valueOf(cm.getPixelSize()); > > - } > > + }*/ > > + public String getDPI(BufferedImage r) throws IOException { > > > > + ColorModel cm = r.getColorModel(); > > + return String.valueOf(cm.getPixelSize()); > > + } > > + > > /* > > * Gets cell size > > */ > > > > > > > > _______________________________________________ > > Jump-pilot-devel mailing list > > Jump-pilot-devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > > > > > > _______________________________________________ > Jump-pilot-devel mailing list > Jump-pilot-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >
_______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel