Package org.opengis.coverage

Examples of org.opengis.coverage.ColorInterpretation


      //
      // Sample dimension
      //
            final SampleModel sm = asciiCoverage.getSampleModel();
            final ColorModel cm = asciiCoverage.getColorModel();
                  final ColorInterpretation colorInterpretation=TypeMap.getColorInterpretation(cm, 0);
                  if(colorInterpretation==null)
                         throw new IOException("Unrecognized sample dimension type");
                 
      final GridSampleDimension band = new GridSampleDimension(
          coverageName, new Category[] { nan }, uom).geophysics(true);
View Full Code Here


        final int numBands = sm.getNumBands();
        final GridSampleDimension[] bands = new GridSampleDimension[numBands];
        // setting bands names.
        for (int i = 0; i < numBands; i++) {
                // color interpretation
        final ColorInterpretation colorInterpretation=TypeMap.getColorInterpretation(cm, i);
        if(colorInterpretation==null)
               throw new IOException("Unrecognized sample dimension type");
       
        // sample dimension type
        final SampleDimensionType st=TypeMap.getSampleDimensionType(sm, i);
           
        // set some no data values, as well as Min and Max values
        final double noData;
        double min=-Double.MAX_VALUE,max=Double.MAX_VALUE;
        if(backgroundValues!=null)
        {
                // sometimes background values are not specified as 1 per each band, therefore we need to be careful
                noData= backgroundValues[backgroundValues.length > i ? i:0];
        }
        else
        {
                if(st.compareTo(SampleDimensionType.REAL_32BITS)==0)
                        noData= Float.NaN;
                else
                        if(st.compareTo(SampleDimensionType.REAL_64BITS)==0)
                                noData= Double.NaN;
                        else
                                if(st.compareTo(SampleDimensionType.SIGNED_16BITS)==0)
                                {
                                        noData=Short.MIN_VALUE;
                                        min=Short.MIN_VALUE;
                                        max=Short.MAX_VALUE;
                                }
                                else
                                        if(st.compareTo(SampleDimensionType.SIGNED_32BITS)==0)
                                        {
                                                noData= Integer.MIN_VALUE;
   
                                                min=Integer.MIN_VALUE;
                                                max=Integer.MAX_VALUE;                                                 
                                        }
                                        else
                                                if(st.compareTo(SampleDimensionType.SIGNED_8BITS)==0)
                                                {
                                                        noData= -128;
                                                        min=-128;
                                                        max=127;
                                                }
                                                else
                                                {
                                                        //unsigned
                                                        noData= 0;
                                                        min=0;
                                                       
                                                       
                                                        // compute max
                                                        if(st.compareTo(SampleDimensionType.UNSIGNED_1BIT)==0)
                                                                max=1;
                                                        else
                                                                if(st.compareTo(SampleDimensionType.UNSIGNED_2BITS)==0)
                                                                        max=3;
                                                                else
                                                                        if(st.compareTo(SampleDimensionType.UNSIGNED_4BITS)==0)
                                                                                max=7;
                                                                        else
                                                                                if(st.compareTo(SampleDimensionType.UNSIGNED_8BITS)==0)
                                                                                        max=255;
                                                                                else
                                                                                        if(st.compareTo(SampleDimensionType.UNSIGNED_16BITS)==0)
                                                                                                max=65535;
                                                                                        else
                                                                                                if(st.compareTo(SampleDimensionType.UNSIGNED_32BITS)==0)
                                                                                                        max=Math.pow(2, 32)-1;
                                                                                                                       
                                                }
               
                                    
        }
        bands[i] = new SimplifiedGridSampleDimension(
                        colorInterpretation.name(),
                        st,
                        colorInterpretation,
                        noData,
                        min,
                        max,
View Full Code Here

    final int numBands = sm.getNumBands();
    final GridSampleDimension[] bands = new GridSampleDimension[numBands];
        // setting bands names.
    Set<String> bandNames = new HashSet<String>();
        for (int i = 0; i < numBands; i++) {
            final ColorInterpretation colorInterpretation = TypeMap.getColorInterpretation(cm, i);
            // make sure we create no duplicate band names
            String bandName;
            if(colorInterpretation == null || colorInterpretation == ColorInterpretation.UNDEFINED
                    || bandNames.contains(colorInterpretation.name())) {
                bandName = "Band" + (i + 1);
            else {
                bandName = colorInterpretation.name();
            }
            bands[i] = new GridSampleDimension(bandName).geophysics(true);
        }

        // creating coverage
View Full Code Here

        final ColorModel cm = image.getColorModel();
        final int numBands = sm.getNumBands();
        final GridSampleDimension[] bands = new GridSampleDimension[numBands];
        // setting bands names.
        for (int i = 0; i < numBands; i++) {
            final ColorInterpretation colorInterpretation = TypeMap.getColorInterpretation(cm, i);
            if (colorInterpretation == null)
                throw new IOException("Unrecognized sample dimension type");
            bands[i] = new GridSampleDimension(colorInterpretation.name()).geophysics(true);
        }
        // creating coverage
        if (raster2Model != null) {
            return coverageFactory.create(coverageName, image,
                    getCoordinateReferenceSystem(coverageName), raster2Model, bands, null, null);
View Full Code Here

            properties.put("GC_NODATA", new Double(noData));
        }
       
        Set<String> bandNames = new HashSet<String>();
        for (int i = 0; i < numBands; i++) {
                final ColorInterpretation colorInterpretation=TypeMap.getColorInterpretation(cm, i);
                if(colorInterpretation==null)
                       throw new IOException("Unrecognized sample dimension type");
                Category[] categories = null;
                if (noDataCategory != null) {
                    categories = new Category[]{noDataCategory};
                }
                String bandName = colorInterpretation.name();
                // make sure we create no duplicate band names
                if(colorInterpretation == ColorInterpretation.UNDEFINED || bandNames.contains(bandName)) {
                    bandName = "Band" + (i + 1);
                }
                bands[i] = new GridSampleDimension(bandName,categories,null).geophysics(true);
View Full Code Here

        final ColorModel cm=image.getColorModel();
    final int numBands = sm.getNumBands();
    final GridSampleDimension[] bands = new GridSampleDimension[numBands];
    // setting bands names.
    for (int i = 0; i < numBands; i++) {
            final ColorInterpretation colorInterpretation=TypeMap.getColorInterpretation(cm, i);
            if(colorInterpretation==null)
                   throw new IOException("Unrecognized sample dimension type");
      bands[i] = new GridSampleDimension(colorInterpretation.name()).geophysics(true);
    }

        return coverageFactory.create(rasterManager.getCoverageIdentifier(), image,new GeneralEnvelope(bbox), bands, null, null);   

  }
View Full Code Here

    final int numBands = sm.getNumBands();
    final GridSampleDimension[] bands = new GridSampleDimension[numBands];
          Set<String> bandNames = new HashSet<String>();   
    // setting bands names.
    for (int i = 0; i < numBands; i++) {
            ColorInterpretation colorInterpretation=null;
            String bandName=null;
            if(cm!=null){
                          // === color interpretation
                    colorInterpretation=TypeMap.getColorInterpretation(cm, i);
                          if(colorInterpretation==null){
                              throw new IOException("Unrecognized sample dimension type");
                          }
                         
                          bandName = colorInterpretation.name();
                                if(colorInterpretation == ColorInterpretation.UNDEFINED || bandNames.contains(bandName)) {// make sure we create no duplicate band names
                                    bandName = "Band" + (i + 1);
                                }
                  } else { // no color model
                      bandName = "Band" + (i + 1);
View Full Code Here

            final ColorModel cm = coverageRaster.getColorModel();
            bands = new GridSampleDimension[imageBands];

            // setting bands names.
            for (int i = 0; i < imageBands; i++) {
                final ColorInterpretation colorInterpretation;
                colorInterpretation = TypeMap.getColorInterpretation(cm, i);
                if (colorInterpretation == null) {
                    throw new IOException("Unrecognized sample dimension type");
                }
                bands[i] = new GridSampleDimension(colorInterpretation.name()).geophysics(true);
            }
        }

        return bands;
    }
View Full Code Here

    final SampleModel sm= raster.getSampleModel();
    if(sm==null)
      throw new IllegalArgumentException("Provided input image with null SampleModel");     
   
    //get the color interpretation for the three bands
    final ColorInterpretation firstBandCI = TypeMap.getColorInterpretation(cm, 0);
   
    //    CMY - CMYK
    if(firstBandCI==ColorInterpretation.CYAN_BAND)
    {
      if(sm.getNumBands()==3)
View Full Code Here

        return false;
      final ColorModel cm= raster.getColorModel();
      if(cm==null)
        return false;       
      //get the color interpretation for the three bands
      final ColorInterpretation firstBandCI = TypeMap.getColorInterpretation(cm, 0);
     
      //    CMY - CMYK
      if(firstBandCI==ColorInterpretation.CYAN_BAND)
        return true;
     
View Full Code Here

TOP

Related Classes of org.opengis.coverage.ColorInterpretation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.