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

Method run

ij/src/main/java/ij/plugin/BMP_Reader.java:26–76  ·  view source on GitHub ↗
(String arg)

Source from the content-addressed store, hash-verified

24public class BMP_Reader extends ImagePlus implements PlugIn {
25
26 public void run(String arg) {
27 OpenDialog od = new OpenDialog("Open BMP...", arg);
28 String directory = od.getDirectory();
29 String name = od.getFileName();
30 if (name==null)
31 return;
32 String path = directory + name;
33
34 //IJ.showStatus("Opening: " + path);
35 BMPDecoder bmp = new BMPDecoder();
36 FileInputStream is = null;
37 try {
38 is = new FileInputStream(path);
39 bmp.read(is);
40 } catch (Exception e) {
41 String msg = e.getMessage();
42 if (msg==null || msg.equals(""))
43 msg = ""+e;
44 if (msg.equals("Compression not supported")) {
45 ImagePlus imp = Opener.openUsingImageIO(path);
46 if (imp!=null) {
47 setProcessor(name, imp.getProcessor());
48 if (arg.equals(""))
49 show();
50 }
51 } else
52 IJ.error("BMP Reader", msg);
53 return;
54 } finally {
55 if (is!=null) {
56 try {
57 is.close();
58 } catch (IOException e) {}
59 }
60 }
61
62 MemoryImageSource mis = bmp.makeImageSource();
63 if (mis==null) IJ.log("BMP_Reader: mis=null");
64 Image img = Toolkit.getDefaultToolkit().createImage(mis);
65 FileInfo fi = new FileInfo();
66 fi.fileFormat = FileInfo.BMP;
67 fi.fileName = name;
68 fi.directory = directory;
69 setImage(img);
70 setTitle(name);
71 setFileInfo(fi);
72 if (bmp.topDown)
73 getProcessor().flipVertical();
74 if (arg.equals(""))
75 show();
76 }
77
78}
79

Callers

nothing calls this directly

Calls 15

getDirectoryMethod · 0.95
getFileNameMethod · 0.95
readMethod · 0.95
openUsingImageIOMethod · 0.95
getProcessorMethod · 0.95
errorMethod · 0.95
makeImageSourceMethod · 0.95
logMethod · 0.95
setFileInfoMethod · 0.80
closeMethod · 0.65
getMessageMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected