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

Method run

ij/src/main/java/ij/plugin/Slicer.java:52–93  ·  view source on GitHub ↗
(String arg)

Source from the content-addressed store, hash-verified

50 private double[] dy;
51
52 public void run(String arg) {
53 imp = WindowManager.getCurrentImage();
54 if (imp==null) {
55 IJ.noImage();
56 return;
57 }
58 int stackSize = imp.getStackSize();
59 Roi roi = imp.getRoi();
60 int roiType = roi!=null?roi.getType():0;
61 // stack required except for ROI = none or RECT
62 if (stackSize<2 && roi!=null && roiType!=Roi.RECTANGLE) {
63 IJ.error("Reslice...", "Stack required");
64 return;
65 }
66 // permissible ROI types: none,RECT,*LINE
67 if (roi!=null && roiType!=Roi.RECTANGLE && roiType!=Roi.LINE && roiType!=Roi.POLYLINE && roiType!=Roi.FREELINE) {
68 IJ.error("Reslice...", "Line or rectangular selection required");
69 return;
70 }
71 if (!showDialog(imp))
72 return;
73 long startTime = System.currentTimeMillis();
74 ImagePlus imp2 = null;
75 rgb = imp.getType()==ImagePlus.COLOR_RGB;
76 notFloat = !rgb && imp.getType()!=ImagePlus.GRAY32;
77 if (imp.isHyperStack())
78 imp2 = resliceHyperstack(imp);
79 else
80 imp2 = reslice(imp);
81 if (imp2==null)
82 return;
83 ImageProcessor ip = imp.getProcessor();
84 double min = ip.getMin();
85 double max = ip.getMax();
86 if (!rgb) imp2.getProcessor().setMinAndMax(min, max);
87 imp2.show();
88 if (noRoi)
89 imp.deleteRoi();
90 else
91 imp.draw();
92 IJ.showStatus(IJ.d2s(((System.currentTimeMillis()-startTime)/1000.0),2)+" seconds");
93 }
94
95 public ImagePlus reslice(ImagePlus imp) {
96 ImagePlus imp2;

Callers

nothing calls this directly

Calls 15

getCurrentImageMethod · 0.95
noImageMethod · 0.95
getTypeMethod · 0.95
errorMethod · 0.95
showDialogMethod · 0.95
resliceHyperstackMethod · 0.95
resliceMethod · 0.95
getMinMethod · 0.95
getMaxMethod · 0.95
getProcessorMethod · 0.95
showMethod · 0.95
showStatusMethod · 0.95

Tested by

no test coverage detected