Displays the dialog and opens the specified image or images. Does nothing if the dialog is canceled.
()
| 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 |
no test coverage detected