コード例 #1
0
ファイル: FitsImage.java プロジェクト: PragyaM/FITS2D
 // TODO handle uncaught exceptions
 public FitsImage(Fits fitsFile, ImageController controller) throws FitsException, IOException {
   this.controller = controller;
   this.fitsFile = fitsFile;
   this.hdu = (ImageHDU) fitsFile.getHDU(0);
   ;
   width = hdu.getAxes()[1];
   height = hdu.getAxes()[0];
   this.tiler = hdu.getTiler();
   setNanColour(controller.getNanColour());
   prepareData();
   createHistogram();
   minValue = histogram.getMinValue();
   maxValue = histogram.getMaxValue();
   writeImage();
 }
コード例 #2
0
ファイル: FitsImage.java プロジェクト: PragyaM/FITS2D
  public void writeImage() {
    RenderImageTask renderImage =
        new RenderImageTask(nanColour, imageFriendlyData, hdu, height, width, histogram);

    ChangeListener<Number> IMAGE_CREATED_LISTENER =
        new ChangeListener<Number>() {
          @Override
          public void changed(
              ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
            if (renderImage.getWorkDone() == 1) {
              image = renderImage.getImage();
              renderImage.workDoneProperty().removeListener(this);
              controller.adjustViewForImage();
              controller.reloadVisibleAnnotationsAndSelections();
            }
          }
        };

    renderImage.workDoneProperty().addListener(IMAGE_CREATED_LISTENER);

    ExecutorService es = controller.createExecutor("RenderImageExecutor");
    es.submit(renderImage);
  }