This is a dialog box used to imports raw 8, 16, 24 and 32-bit images.
| 16 | |
| 17 | /** This is a dialog box used to imports raw 8, 16, 24 and 32-bit images. */ |
| 18 | public class ImportDialog { |
| 19 | private String fileName; |
| 20 | private String directory; |
| 21 | static final String TYPE = "raw.type"; |
| 22 | static final String WIDTH = "raw.width"; |
| 23 | static final String HEIGHT = "raw.height"; |
| 24 | static final String OFFSET = "raw.offset"; |
| 25 | static final String N = "raw.n"; |
| 26 | static final String GAP = "raw.gap"; |
| 27 | static final String OPTIONS = "raw.options"; |
| 28 | static final int WHITE_IS_ZERO = 1; |
| 29 | static final int INTEL_BYTE_ORDER = 2; |
| 30 | static final int OPEN_ALL = 4; |
| 31 | |
| 32 | // default settings |
| 33 | private static int sChoiceSelection = Prefs.getInt(TYPE,0); |
| 34 | private static int sWidth = Prefs.getInt(WIDTH,512); |
| 35 | private static int sHeight = Prefs.getInt(HEIGHT,512); |
| 36 | private static long sOffset = Prefs.getInt(OFFSET,0); |
| 37 | private static int sNImages = Prefs.getInt(N,1); |
| 38 | private static long sGapBetweenImages = Prefs.getInt(GAP,0); |
| 39 | private static boolean sWhiteIsZero; |
| 40 | private static boolean sIntelByteOrder; |
| 41 | private static boolean sVirtual; |
| 42 | private int choiceSelection = sChoiceSelection; |
| 43 | private int width = sWidth; |
| 44 | private int height = sHeight; |
| 45 | private long offset = sOffset; |
| 46 | private int nImages = sNImages; |
| 47 | private long gapBetweenImages = sGapBetweenImages; |
| 48 | private boolean whiteIsZero = sWhiteIsZero; |
| 49 | private boolean intelByteOrder = sIntelByteOrder; |
| 50 | private boolean virtual = sVirtual; |
| 51 | |
| 52 | private static int options; |
| 53 | private static FileInfo lastFileInfo; |
| 54 | private boolean openAll; |
| 55 | private static String[] types = {"8-bit", "16-bit Signed", "16-bit Unsigned", |
| 56 | "32-bit Signed", "32-bit Unsigned", "32-bit Real", "64-bit Real", "24-bit RGB", |
| 57 | "24-bit RGB Planar", "24-bit BGR", "24-bit Integer", "32-bit ARGB", "32-bit ABGR", "1-bit Bitmap"}; |
| 58 | |
| 59 | static { |
| 60 | options = Prefs.getInt(OPTIONS, 0); |
| 61 | sWhiteIsZero = (options&WHITE_IS_ZERO)!=0; |
| 62 | sIntelByteOrder = (options&INTEL_BYTE_ORDER)!=0; |
| 63 | } |
| 64 | |
| 65 | public ImportDialog(String fileName, String directory) { |
| 66 | this.fileName = fileName; |
| 67 | this.directory = directory; |
| 68 | IJ.showStatus("Importing: " + fileName); |
| 69 | } |
| 70 | |
| 71 | public ImportDialog() { |
| 72 | } |
| 73 | |
| 74 | boolean showDialog() { |
| 75 | boolean macro = Macro.getOptions()!=null; |