Displays the dialog and returns a FileInfo object that can be used to open the image. Returns null if the dialog is canceled. The fileName and directory fields are null if the no argument constructor was used.
()
| 235 | open the image. Returns null if the dialog is canceled. The fileName |
| 236 | and directory fields are null if the no argument constructor was used. */ |
| 237 | public FileInfo getFileInfo() { |
| 238 | if (!showDialog()) |
| 239 | return null; |
| 240 | String imageType = types[choiceSelection]; |
| 241 | FileInfo fi = new FileInfo(); |
| 242 | fi.fileFormat = fi.RAW; |
| 243 | fi.fileName = fileName; |
| 244 | directory = IJ.addSeparator(directory); |
| 245 | fi.directory = directory; |
| 246 | fi.width = width; |
| 247 | fi.height = height; |
| 248 | if (offset>2147483647) |
| 249 | fi.longOffset = offset; |
| 250 | else |
| 251 | fi.offset = (int)offset; |
| 252 | fi.nImages = nImages; |
| 253 | fi.gapBetweenImages = (int)gapBetweenImages; |
| 254 | fi.longGap = gapBetweenImages; |
| 255 | fi.intelByteOrder = intelByteOrder; |
| 256 | fi.whiteIsZero = whiteIsZero; |
| 257 | if (imageType.equals("8-bit")) |
| 258 | fi.fileType = FileInfo.GRAY8; |
| 259 | else if (imageType.equals("16-bit Signed")) |
| 260 | fi.fileType = FileInfo.GRAY16_SIGNED; |
| 261 | else if (imageType.equals("16-bit Unsigned")) |
| 262 | fi.fileType = FileInfo.GRAY16_UNSIGNED; |
| 263 | else if (imageType.equals("32-bit Signed")) |
| 264 | fi.fileType = FileInfo.GRAY32_INT; |
| 265 | else if (imageType.equals("32-bit Unsigned")) |
| 266 | fi.fileType = FileInfo.GRAY32_UNSIGNED; |
| 267 | else if (imageType.equals("32-bit Real")) |
| 268 | fi.fileType = FileInfo.GRAY32_FLOAT; |
| 269 | else if (imageType.equals("64-bit Real")) |
| 270 | fi.fileType = FileInfo.GRAY64_FLOAT; |
| 271 | else if (imageType.equals("24-bit RGB")) |
| 272 | fi.fileType = FileInfo.RGB; |
| 273 | else if (imageType.equals("24-bit RGB Planar")) |
| 274 | fi.fileType = FileInfo.RGB_PLANAR; |
| 275 | else if (imageType.equals("24-bit BGR")) |
| 276 | fi.fileType = FileInfo.BGR; |
| 277 | else if (imageType.equals("24-bit Integer")) |
| 278 | fi.fileType = FileInfo.GRAY24_UNSIGNED; |
| 279 | else if (imageType.equals("32-bit ARGB")) |
| 280 | fi.fileType = FileInfo.ARGB; |
| 281 | else if (imageType.equals("32-bit ABGR")) |
| 282 | fi.fileType = FileInfo.ABGR; |
| 283 | else if (imageType.equals("1-bit Bitmap")) |
| 284 | fi.fileType = FileInfo.BITMAP; |
| 285 | else |
| 286 | fi.fileType = FileInfo.GRAY8; |
| 287 | if (IJ.debugMode) IJ.log("ImportDialog: "+fi); |
| 288 | lastFileInfo = (FileInfo)fi.clone(); |
| 289 | return fi; |
| 290 | } |
| 291 | |
| 292 | /** Called once when ImageJ quits. */ |
| 293 | public static void savePreferences(Properties prefs) { |
no test coverage detected