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

Method getInfo

ij/src/main/java/ij/plugin/ImageInfo.java:148–507  ·  view source on GitHub ↗
(ImagePlus imp, ImageProcessor ip)

Source from the content-addressed store, hash-verified

146 }
147
148 private String getInfo(ImagePlus imp, ImageProcessor ip) {
149 String s = new String("");
150 if (IJ.getInstance()!=null)
151 s += IJ.getInstance().getInfo()+"\n \n";
152 s += "Title: " + imp.getTitle() + "\n";
153 Calibration cal = imp.getCalibration();
154 int stackSize = imp.getStackSize();
155 int channels = imp.getNChannels();
156 int slices = imp.getNSlices();
157 int frames = imp.getNFrames();
158 int digits = imp.getBitDepth()==32?4:0;
159 int dp, dp2;
160 boolean nonUniformUnits = !cal.getXUnit().equals(cal.getYUnit());
161 String xunit = cal.getXUnit();
162 String yunit = cal.getYUnit();
163 String zunit = cal.getZUnit();
164 if (cal.scaled()) {
165 String xunits = cal.getUnits();
166 String yunits = xunits;
167 String zunits = xunits;
168 if (nonUniformUnits) {
169 xunits = xunit;
170 yunits = yunit;
171 zunits = zunit;
172 }
173 double pw = imp.getWidth()*cal.pixelWidth;
174 double ph = imp.getHeight()*cal.pixelHeight;
175 s += "Width: "+d2s(pw)+" " + xunits+" ("+imp.getWidth()+")\n";
176 s += "Height: "+d2s(ph)+" " + yunits+" ("+imp.getHeight()+")\n";
177 if (slices>1) {
178 double pd = slices*cal.pixelDepth;
179 s += "Depth: "+d2s(pd)+" " + zunits+" ("+slices+")\n";
180 }
181 s += "Size: "+ImageWindow.getImageSize(imp)+"\n";
182 double xResolution = 1.0/cal.pixelWidth;
183 double yResolution = 1.0/cal.pixelHeight;
184 if (xResolution==yResolution)
185 s += "Resolution: "+d2s(xResolution) + " pixels per "+xunit+"\n";
186 else {
187 s += "X Resolution: "+d2s(xResolution) + " pixels per "+xunit+"\n";
188 s += "Y Resolution: "+d2s(yResolution) + " pixels per "+yunit+"\n";
189 }
190 } else {
191 s += "Width: " + imp.getWidth() + " pixels\n";
192 s += "Height: " + imp.getHeight() + " pixels\n";
193 if (stackSize>1)
194 s += "Depth: " + slices + " pixels\n";
195 s += "Size: "+ImageWindow.getImageSize(imp)+"\n";
196 }
197 if (stackSize>1) {
198 String vunit = cal.getUnit()+"^3";
199 if (nonUniformUnits)
200 vunit = "("+xunit+" x "+yunit+" x "+zunit+")";
201 s += "Voxel size: "+d2s(cal.pixelWidth)+"x"+d2s(cal.pixelHeight)+"x"+d2s(cal.pixelDepth)+" "+vunit+"\n";
202 } else {
203 String punit = cal.getUnit()+"^2";
204 if (nonUniformUnits)
205 punit = "("+xunit+" x "+yunit+")";

Callers 2

getImageInfoMethod · 0.95
showInfoMethod · 0.45

Calls 15

getInstanceMethod · 0.95
getXUnitMethod · 0.95
getYUnitMethod · 0.95
getZUnitMethod · 0.95
scaledMethod · 0.95
getUnitsMethod · 0.95
d2sMethod · 0.95
getImageSizeMethod · 0.95
getUnitMethod · 0.95
getDecimalPlacesMethod · 0.95
getLutInfoMethod · 0.95
getDisplayRangesMethod · 0.95

Tested by

no test coverage detected