/********************************************************************** * $Id$ * * Name: Overviews.java * Project: * Purpose: * Author: Nacho Brodin, brodin_ign@gva.es * **********************************************************************/ /* gvSIG. Sistema de Información Geográfica de la Generalitat Valenciana * * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. * * For more information, contact: * * Generalitat Valenciana * Conselleria d'Infraestructures i Transport * Av. Blasco Ibáñez, 50 * 46010 VALENCIA * SPAIN * * +34 963862235 * gvsig@gva.es * www.gvsig.gva.es * * or * * IVER T.I. S.A * Salamanca 50 * 46005 Valencia * Spain * * +34 963163400 * dac@iver.es */ import es.gva.cit.jmrsid.*; import java.io.*; /** * Ejemplo de acceso a una overview de un mrsid. Accede a la imagen pasada como parámetro muestra * alguna información y a partir de la última overview salva a .raw toda la imagen. * * @author Nacho Brodin .
Equipo de desarrollo gvSIG.
http://www.gvsig.gva.es * @version 0.0 * @link http://www.gvsig.gva.es */ public class Overviews4 { public static void main(String[] args){ LTIImageReader img; LTIMetadataDatabase metadata; LTIPixel pixel; int eColorSpace, nBands, eSampleType; try{ img = new MrSIDImageReader(args[0]); img.initialize(); //Obtenemos algunos datos int overviews=((MrSIDImageReader)img).getNumLevels()-1; System.out.println("Overviews="+overviews); System.out.println("Width="+img.getWidth()); System.out.println("Height="+img.getHeight()); System.out.println("Stripsheigth="+img.getStripHeight()); nBands=img.getNumBands(); System.out.println("NumBands="+nBands); eColorSpace=img.getColorSpace(); System.out.println("ColorSpace="+eColorSpace); eSampleType=img.getDataType(); System.out.println("DataType="+eSampleType); pixel=new LTIPixel(eColorSpace, nBands, eSampleType); System.out.println("**************Zoom******************"); double zoom = LTIUtils.levelToMag(4); int[] dims=img.getDimsAtMag(zoom); System.out.println("Dims At overview "+overviews+"= "+dims[0]+" "+dims[1]); System.out.println("Zoom="+zoom); System.out.println("************************************"); //Creamos la escena con el tamaño del overview deseado LTIScene scene=new LTIScene(0,0,dims[0],dims[1],zoom); LTISceneBuffer buffer=new LTISceneBuffer(pixel,dims[0],dims[1],true); ((LTIImageStage)img).read(scene,buffer); FileOutputStream s=null; try{ File mifichero=new File("exit.raw"); s = new FileOutputStream(mifichero); }catch(Exception e){} try{ for(int j=0;j