Create an OpenDialog, and read in the selected FITS file.
(String path)
| 1235 | * Create an {@link OpenDialog}, and read in the selected FITS file. |
| 1236 | */ |
| 1237 | private PostFitsRead getHDU(String path) throws FitsException, IOException { |
| 1238 | OpenDialog od = new OpenDialog("Open FITS...", path); |
| 1239 | directory = od.getDirectory(); |
| 1240 | fileName = od.getFileName(); |
| 1241 | if (fileName == null) { |
| 1242 | throw new FitsException("Null filename."); |
| 1243 | } |
| 1244 | IJ.showStatus("Opening: " + directory + fileName); |
| 1245 | //IJ.log("Opening: " + directory + fileName); |
| 1246 | |
| 1247 | FitsFactory.setAllowHeaderRepairs(true); |
| 1248 | |
| 1249 | var fr = getFitsFile(path); |
| 1250 | if (fr.hasErrored) return null; |
| 1251 | Fits f = null; |
| 1252 | try { |
| 1253 | f = fr.fits; |
| 1254 | var hdus = f.read(); |
| 1255 | fr.close(); |
| 1256 | |
| 1257 | return new PostFitsRead(f, hdus); |
| 1258 | } catch (FitsException e) { |
| 1259 | closeThing(f); |
| 1260 | throw e; |
| 1261 | } |
| 1262 | } |
| 1263 | |
| 1264 | /** |
| 1265 | * Opens a FITS file from the path. If it is in a zip file, it will open the zip |
no test coverage detected