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

Method openImage

ij/src/main/java/ij/io/ImportDialog.java:193–232  ·  view source on GitHub ↗

Displays the dialog and opens the specified image or images. Does nothing if the dialog is canceled.

()

Source from the content-addressed store, hash-verified

191 /** Displays the dialog and opens the specified image or images.
192 Does nothing if the dialog is canceled. */
193 public void openImage() {
194 FileInfo fi = getFileInfo();
195 if (fi==null)
196 return;
197 if (openAll) {
198 if (virtual) {
199 ImagePlus imp = Raw.openAllVirtual(directory, fi);
200 String dir = Recorder.fixPath(directory);
201 Recorder.recordCall(fi.getCode()+"imp = Raw.openAllVirtual(\""+dir+"\", fi);");
202 if (imp!=null) {
203 imp.setSlice(imp.getStackSize()/2);
204 imp.show();
205 imp.setSlice(1);
206 }
207 return;
208 }
209 String[] list = new File(directory).list();
210 if (list==null) return;
211 openAll(directory, list, fi);
212 } else if (virtual)
213 new FileInfoVirtualStack(fi);
214 else {
215 FileOpener fo = new FileOpener(fi);
216 ImagePlus imp = fo.openImage();
217 String filePath = fi.getFilePath();
218 filePath = Recorder.fixPath(filePath);
219 Recorder.recordCall(fi.getCode()+"imp = Raw.open(\""+filePath+"\", fi);");
220 if (imp!=null) {
221 imp.show();
222 int n = imp.getStackSize();
223 if (n>1) {
224 imp.setSlice(n/2);
225 ImageProcessor ip = imp.getProcessor();
226 ip.resetMinAndMax();
227 imp.setDisplayRange(ip.getMin(),ip.getMax());
228 }
229 } else
230 IJ.error("File>Import>Raw", "File not found: "+filePath);
231 }
232 }
233
234 /** Displays the dialog and returns a FileInfo object that can be used to
235 open the image. Returns null if the dialog is canceled. The fileName

Callers 2

runMethod · 0.95
openAllMethod · 0.45

Calls 15

getFileInfoMethod · 0.95
openAllVirtualMethod · 0.95
fixPathMethod · 0.95
recordCallMethod · 0.95
getCodeMethod · 0.95
setSliceMethod · 0.95
getStackSizeMethod · 0.95
showMethod · 0.95
openAllMethod · 0.95
openImageMethod · 0.95
getFilePathMethod · 0.95
getProcessorMethod · 0.95

Tested by

no test coverage detected