MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / putHeader

Method putHeader

Astronomy_/src/main/java/astroj/FitsJ.java:632–653  ·  view source on GitHub ↗

Saves a FITS header in an array of Strings back into an ImagePlus's "Info" property.

(ImagePlus img, Header hdr)

Source from the content-addressed store, hash-verified

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.

Callers 15

runMethod · 0.95
runMethod · 0.95
processMethod · 0.95
createMasterBiasMethod · 0.95
createMasterDarkMethod · 0.95
createMasterFlatMethod · 0.95
getAdjustedIpMethod · 0.95
processDataMethod · 0.95
runMethod · 0.95
getMeanImageMethod · 0.95
runMethod · 0.95
rebinGrayscaleImageMethod · 0.95

Calls 10

unsplitMethod · 0.95
getSliceLabelMethod · 0.95
setSliceLabelMethod · 0.95
getCurrentSliceMethod · 0.80
substringMethod · 0.80
getStackSizeMethod · 0.45
setPropertyMethod · 0.45
getStackMethod · 0.45
indexOfMethod · 0.45
trimMethod · 0.45

Tested by

no test coverage detected