Saves a FITS header in an array of Strings back into an ImagePlus's "Info" property.
(ImagePlus img, Header hdr)
| 630 | * Saves a FITS header in an array of Strings back into an ImagePlus's "Info" property. |
| 631 | */ |
| 632 | public static void putHeader(ImagePlus img, Header hdr) { |
| 633 | String s = "AIJ-HEADER-MARKER\n" + unsplit(hdr.cards, "\n"); |
| 634 | |
| 635 | int depth = img.getStackSize(); |
| 636 | if (depth == 1) { |
| 637 | img.setProperty("Info", s); |
| 638 | } else if (depth > 1) { |
| 639 | int slice = img.getCurrentSlice(); |
| 640 | ImageStack stack = img.getStack(); |
| 641 | String label = stack.getSliceLabel(slice); |
| 642 | if (label == null) { |
| 643 | img.setProperty("Info", s); |
| 644 | } else { |
| 645 | int newline = label.indexOf('\n'); |
| 646 | if (newline != -1) { |
| 647 | label = label.substring(0, newline); |
| 648 | } |
| 649 | label = label.trim(); |
| 650 | stack.setSliceLabel(label + "\n" + s, slice); |
| 651 | } |
| 652 | } |
| 653 | } |
| 654 | |
| 655 | /** |
| 656 | * Saves a FITS header in an array of Strings back into an ImageStack's current slice. |
no test coverage detected