/**
   * Loads the thumbnail for passed collection of pixels set.
   *
   * @param ids The collection of pixels set id.
   */
  private void loadThumbnails(List ids) {
    try {
      Map<Long, BufferedImage> m = service.getThumbnailSet(ctx, ids, maxLength);
      List<Object> result = new ArrayList<Object>();
      Iterator<Long> i = m.keySet().iterator();
      long pixelsID;
      BufferedImage thumbPix;
      DataObject obj;
      boolean valid = true;
      long imageID = -1;
      PixelsData pxd = null;
      while (i.hasNext()) {
        pixelsID = i.next();
        obj = input.get(pixelsID);
        if (obj instanceof ImageData) {
          imageID = ((ImageData) obj).getId();
          pxd = ((ImageData) obj).getDefaultPixels();
        } else if (obj instanceof PixelsData) {
          pxd = (PixelsData) obj;
          imageID = pxd.getImage().getId();
        }
        if (pxd != null) {
          thumbPix = (BufferedImage) m.get(pixelsID);
          if (thumbPix == null) thumbPix = createDefaultImage(pxd);
          result.add(new ThumbnailData(imageID, thumbPix, valid));
        }
      }
      currentThumbs = result;

    } catch (RenderingServiceException e) {
      context.getLogger().error(this, "Cannot retrieve thumbnail: " + e.getExtendedMessage());
    }
  }