Example #1
0
 // 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();
 }
Example #2
0
  private void prepareData() {

    double[] img = null;
    try {
      Object dataArray = tiler.getTile(new int[] {0, 0}, hdu.getAxes());
      img = (double[]) ArrayFuncs.convertArray(dataArray, double.class);
      data = (float[]) ArrayFuncs.convertArray(img, float.class);
      processingFriendlyData = (double[][]) ArrayFuncs.convertArray(hdu.getKernel(), double.class);
      imageFriendlyData = new double[width * height];
      for (int h = height - 1; h >= 0; h--) {
        for (int w = 0; w < width; w++) {
          imageFriendlyData[h * width + w] = (img[(height - 1 - h) * width + w]);
        }
      }
    } catch (IOException | FitsException e) {
      e.printStackTrace();
    }

    System.out.println(processingFriendlyData.length + ", " + processingFriendlyData[0].length);
  }