/// <summary>Is this a random groups header?</summary> /// <param name="myHeader">The header to be tested.</param> public static new bool IsHeader(Header hdr) { if (hdr.GetBooleanValue("SIMPLE")) { return hdr.GetBooleanValue("GROUPS"); } String s = hdr.GetStringValue("XTENSION"); if (s.Trim().Equals("IMAGE")) { return hdr.GetBooleanValue("GROUPS"); } return false; }
/// <summary>Create FITS data object corresponding to a given header.</summary> public static Data ManufactureData(Header hdr) { int gcount = hdr.GetIntValue("GCOUNT", - 1); int pcount = hdr.GetIntValue("PCOUNT", - 1); if (!hdr.GetBooleanValue("GROUPS") || hdr.GetIntValue("NAXIS1", - 1) != 0 || gcount < 0 || pcount < 0 || hdr.GetIntValue("NAXIS") < 2) { throw new FitsException("Invalid Random Groups Parameters"); } // Allocate the object. Object[][] dataArray; if (gcount > 0) { dataArray = new Object[gcount][]; for (int i = 0; i < gcount; i++) { dataArray[i] = new Object[2]; } } else { dataArray = new Object[0][]; } Object[] sampleRow = GenerateSampleRow(hdr); for (int i = 0; i < gcount; i += 1) { ((Object[][]) dataArray)[i][0] = ((Object[]) ArrayFuncs.DeepClone(sampleRow))[0]; ((Object[][]) dataArray)[i][1] = ((Object[]) ArrayFuncs.DeepClone(sampleRow))[1]; } return new RandomGroupsData(dataArray); }
/// <summary>Check that this HDU has a valid header for this type.</summary> /// <returns> <CODE>true</CODE> if this HDU has a valid header.</returns> public static new bool IsHeader(Header hdr) { bool found = false; found = hdr.GetBooleanValue("SIMPLE"); if (!found) { String s = hdr.GetStringValue("XTENSION"); if (s != null) { if (s.Trim().Equals("IMAGE") || s.Trim().Equals("IUEIMAGE")) { found = true; } } } if (!found) { return false; } return !hdr.GetBooleanValue("GROUPS"); }