Esempio n. 1
0
  static void initPlotTitle(
      PlotState state,
      ImagePlot plot,
      ActiveFitsReadGroup frGroup,
      String dataDesc,
      boolean isMultiImage) {
    WebPlotRequest req = state.getPrimaryWebPlotRequest();
    WebPlotRequest.TitleOptions titleOps = req.getTitleOptions();
    String headerKey = req.getHeaderKeyForTitle();
    if ((isMultiImage
            && (titleOps == WebPlotRequest.TitleOptions.NONE
                || titleOps == WebPlotRequest.TitleOptions.FILE_NAME))
        || (titleOps == WebPlotRequest.TitleOptions.HEADER_KEY && StringUtils.isEmpty(headerKey))) {
      titleOps = WebPlotRequest.TitleOptions.HEADER_KEY;
      headerKey = "EXTNAME";
    }
    String s = req.getPlotDescAppend();
    plot.setPlotDesc("");
    Header header = frGroup.getFitsRead(state.firstBand()).getHeader();

    switch (titleOps) {
      case NONE:
        plot.setPlotDesc("");
        break;
      case PLOT_DESC:
        String base = req.getTitle() == null ? "" : req.getTitle();
        plot.setPlotDesc(base + dataDesc);
        break;
      case FILE_NAME:
        break;
      case HEADER_KEY:
        HeaderCard card = header.findCard(headerKey);
        if (card == null && state.getCubeCnt(state.firstBand()) > 0) {
          card = header.findCard("PLANE" + state.getImageIdx(state.firstBand()));
        }
        String hTitle = card != null ? card.getValue() : "";
        plot.setPlotDesc(hTitle);
        break;
      case PLOT_DESC_PLUS:
        plot.setPlotDesc(req.getTitle() + (s != null ? " " + s : ""));
        break;
      case SERVICE_OBS_DATE:
        if (req.getRequestType() == RequestType.SERVICE) {
          //                    String desc= req.getServiceType()== WebPlotRequest.ServiceType.WISE
          // ? MID_OBS : OBS_DATE;
          String title =
              req.getTitle()
                  + ": "
                  +
                  //                                  desc + ": " +
                  PlotServUtils.getDateValueFromServiceFits(req.getServiceType(), header);
          plot.setPlotDesc(title);
        }
        break;
    }
  }
Esempio n. 2
0
  @Test
  public void testBigDataSegments() throws Exception {
    ImageData data = new ImageData(new float[4][4]);

    Header manufactureHeader = ImageHDU.manufactureHeader(data);
    manufactureHeader.card(Standard.END).comment("");
    manufactureHeader.findCard(Standard.NAXIS1).setValue(25000);
    manufactureHeader.findCard(Standard.NAXIS2).setValue(25000);

    long value = manufactureHeader.getDataSize();
    int intValue = (int) manufactureHeader.getDataSize();
    assertEquals(2500001280L, value);
    Assert.assertTrue(intValue != value);
  }
Esempio n. 3
0
  public String getWcsHeaderCardsString() {
    Header header = hdu.getHeader();
    Header filteredHeader = new Header();

    // now adjust WCS values:
    ArrayList<HeaderCard> cards = new ArrayList<HeaderCard>();
    cards.add(header.findCard("CTYPE1"));
    cards.add(header.findCard("CTYPE2"));
    cards.add(header.findCard("RADESYS"));
    cards.add(header.findCard("RADECSYS"));
    cards.add(header.findCard("CRVAL1"));
    cards.add(header.findCard("CRVAL2"));
    cards.add(header.findCard("CDELT1"));
    cards.add(header.findCard("CDELT2"));
    cards.add(header.findCard("EQUINOX"));
    cards.add(header.findCard("BUNIT"));
    cards.add(header.findCard("EPOCH"));
    cards.add(header.findCard("CD1_1"));
    cards.add(header.findCard("CD1_2"));
    cards.add(header.findCard("CD2_1"));
    cards.add(header.findCard("CD2_2"));
    cards.add(header.findCard("CRPIX1"));
    cards.add(header.findCard("CRPIX2"));
    cards.add(header.findCard("END"));

    cards.forEach(
        (card) -> {
          if (card != null) {
            try {
              filteredHeader.addLine(card);
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        });
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(baos);
    filteredHeader.dumpHeader(ps);
    String wcsHdrString = baos.toString();
    try {
      baos.close();
    } catch (IOException e) {
      e.printStackTrace();
    }
    ps.close();

    return wcsHdrString;
  }