Exemplo n.º 1
0
 /** Creates the images composing the grid. */
 private void createGridImages() {
   // if (combinedImage == null) return;
   if (originalGridImages == null) originalGridImages = new ArrayList<BufferedImage>();
   clearList(gridImages);
   if (ImViewer.GREY_SCALE_MODEL.equals(parent.getColorModel())) {
     createGridImagesForGreyScale();
     return;
   }
   List l = parent.getActiveChannels();
   int maxC = parent.getMaxC();
   switch (l.size()) {
     case 0:
       for (int i = 0; i < maxC; i++) gridImages.add(null);
       break;
     case 1:
     case 2:
     case 3:
       if (isImageMappedRGB(l) && !parent.isCompressed()) {
         combinedImage = null;
         combinedImage = Factory.magnifyImage(gridRatio, renderedImage);
         int w = combinedImage.getWidth();
         int h = combinedImage.getHeight();
         DataBuffer buf = combinedImage.getRaster().getDataBuffer();
         List<ChannelData> list = parent.getSortedChannelData();
         Iterator<ChannelData> i = list.iterator();
         int index;
         while (i.hasNext()) {
           index = i.next().getIndex();
           if (parent.isChannelActive(index)) {
             if (parent.isChannelRed(index)) {
               gridImages.add(
                   Factory.createBandImage(
                       buf, w, h, Factory.RED_MASK, Factory.BLANK_MASK, Factory.BLANK_MASK));
             } else if (parent.isChannelGreen(index)) {
               gridImages.add(
                   Factory.createBandImage(
                       buf, w, h, Factory.BLANK_MASK, Factory.GREEN_MASK, Factory.BLANK_MASK));
             } else if (parent.isChannelBlue(index)) {
               gridImages.add(
                   Factory.createBandImage(
                       buf, w, h, Factory.BLANK_MASK, Factory.BLANK_MASK, Factory.BLUE_MASK));
             }
           } else {
             gridImages.add(null);
           }
         }
       } else {
         retrieveGridImages();
       }
       break;
     default:
       retrieveGridImages();
   }
 }
Exemplo n.º 2
0
 /**
  * Returns the list of grid images for openGL.
  *
  * @return See above.
  */
 List<GridImage> getGridImages() {
   List<GridImage> list = new ArrayList<GridImage>();
   List<ChannelData> l = parent.getSortedChannelData();
   Iterator<ChannelData> i = l.iterator();
   int index;
   GridImage image;
   // boolean[] rgb;
   ChannelData data;
   String label;
   boolean b = isRenderedImageRGB();
   if (!isModelRGB()) b = false;
   while (i.hasNext()) {
     data = i.next();
     index = data.getIndex();
     label = data.getChannelLabeling();
     // rgb = new boolean[3];
     if (parent.isChannelActive(index)) {
       /*
       if (b) {
       	rgb[0] = !parent.isChannelRed(index);
       	rgb[1] = !parent.isChannelGreen(index);
       	rgb[2] = !parent.isChannelBlue(index);
       	image = new GridImage(index, true, label, rgb);
       } else {
       	image = new GridImage(index, true, label);
       	image.setTextureData(gridImagesAsTextures.get(index));
       }
       */
       image = new GridImage(index, true, label);
       image.setTextureData(gridImagesAsTextures.get(index));
     } else {
       image = new GridImage(index, false, label);
     }
     list.add(image);
   }
   return list;
 }