Skip to content

Commit

Permalink
2024.05.24 (1.54j22; ROI Manager saving)
Browse files Browse the repository at this point in the history
  • Loading branch information
rasband committed May 25, 2024
1 parent 09d093c commit 6f6e828
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 24 deletions.
12 changes: 9 additions & 3 deletions functions.html
Original file line number Diff line number Diff line change
Expand Up @@ -4542,6 +4542,13 @@ <h1>Built-in Macro Functions</h1>
Enables/disables monospaced text in the "Log" window.
Requires 1.54c.
<br>

<a name="setOption_MouseWheelStackScrolling"></a>
<b>setOption("MouseWheelStackScrolling", boolean)</b><br>
Enables/disables mouse wheel stack scrolling.
Requires 1.54j.
<br>

<a name="setOption_OpenGrayscaleJpegsAsRGB"></a>
<b>setOption("OpenGrayscaleJpegsAsRGB", boolean)</b><br>
Enable to open grayscale RGB JPEGs as RGB images.
Expand Down Expand Up @@ -5431,8 +5438,7 @@ <h1>Built-in Macro Functions</h1>
To display a multi-line
message, add newline characters ("\n") to <i>string</i>.
This function is based on
Michael Schmid's
<a href="https://imagejdocu.tudor.lu/imagej-documentation-wiki/plugins/wait_for_user">Wait_For_User</a> plugin.
Michael Schmid's "Wait For User" plugin.
Example:
<a href="../../macros/WaitForUserDemo.txt">WaitForUserDemo</a>.
<p>
Expand All @@ -5453,7 +5459,7 @@ <h1>Built-in Macro Functions</h1>

<p class=navbar> <a href="#Top">top</a> | <a href="https://imagej.nih.gov/ij/index.html">home</a></p>

<small>Last updated 2024/03/13</small>
<small>Last updated 2024/05/15</small>

</body>
</html>
1 change: 1 addition & 0 deletions ij/IJ.java
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,7 @@ public static void showMessage(String title, String msg) {
if (isMacro() && md.escapePressed())
throw new RuntimeException(Macro.MACRO_CANCELED);
}
IJ.wait(25); // fix GenericDialog non-editable text field
} else
System.out.println(msg);
}
Expand Down
2 changes: 1 addition & 1 deletion ij/ImageJ.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class ImageJ extends Frame implements ActionListener,

/** Plugins should call IJ.getVersion() or IJ.getFullVersion() to get the version string. */
public static final String VERSION = "1.54j";
public static final String BUILD = "15";
public static final String BUILD = "22";
public static Color backgroundColor = new Color(237,237,237);
/** SansSerif, 12-point, plain font. */
public static final Font SansSerif12 = new Font("SansSerif", Font.PLAIN, 12);
Expand Down
2 changes: 2 additions & 0 deletions ij/Prefs.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ public class Prefs {
public static boolean calibrateConversions;
/** Open grayscale RGB JPEGs as RGB */
public static boolean openGrayscaleJpegsAsRGB;
/** Scroll stacks using mouse wheel */
public static boolean mouseWheelStackScrolling = true;

//Save location of moved image windows */
//public static boolean saveImageLocation = true;
Expand Down
6 changes: 5 additions & 1 deletion ij/gui/GenericDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -2005,7 +2005,11 @@ public TextDropTarget(TextField text) {
@Override
public void drop(DropTargetDropEvent event) {
try {
text.setText(getString(event));
String path = getString(event);
path = Recorder.fixPath(path);
if (!path.endsWith("/")&& (new File(path)).isDirectory())
path = path + "/";
text.setText(path);
} catch (Exception e) { e.printStackTrace(); }
}
}
Expand Down
2 changes: 2 additions & 0 deletions ij/gui/StackWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ else if (rotation>0)
ic.zoomOut(x,y);
return;
}
if (!Prefs.mouseWheelStackScrolling)
return;
if (hyperStack) {
if (rotation>0)
IJ.run(imp, "Next Slice [>]", "");
Expand Down
6 changes: 4 additions & 2 deletions ij/macro/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -4796,7 +4796,9 @@ else if (arg1.startsWith("opengrayscale"))
else if (arg1.startsWith("calibrate")) {
Prefs.calibrateConversions = state;
ImageConverter.setDoScaling(true);
} else
} else if (arg1.startsWith("mousewheel"))
Prefs.mouseWheelStackScrolling = state;
else
interp.error("Invalid option");
}

Expand Down Expand Up @@ -7149,7 +7151,7 @@ void addDrawingToOverlay(ImagePlus imp) {

void addRoi(ImagePlus imp, Roi roi){
Overlay overlay = imp.getOverlay();
if (overlay==null || overlay.size()==0) {
if (overlay==null) {
if (offscreenOverlay==null)
offscreenOverlay = new Overlay();
overlay = offscreenOverlay;
Expand Down
29 changes: 15 additions & 14 deletions ij/plugin/ZProjector.java
Original file line number Diff line number Diff line change
Expand Up @@ -659,20 +659,23 @@ private ImagePlus doAverageFloatProjection(ImagePlus imp) {
int d = stack.getSize();
ImagePlus projection = IJ.createImage(makeTitle(), "32-bit Black", w, h, 1);
ImageProcessor ip = projection.getProcessor();
for (int x=0; x<w; x++) {
for (int y=0; y<h; y++) {
double sum = 0.0;
int count = 0;
for (int z=startSlice-1; z<stopSlice; z+=increment) {
double value = stack.getVoxel(x, y, z);
if (!Double.isNaN(value)) {
sum += value;
count++;
}
}
ip.setf(x, y, (float)(sum/count));
double[] sum = new double[w*h];
int[] count = new int[w*h];
for (int z=startSlice; z<=stopSlice; z+=increment) {
ImageProcessor stackIp = stack.getProcessor(z);
for (int y=0, p=0; y<h; y++) {
for (int x=0; x<w; x++, p++) {
float value = stackIp.getPixelValue(x, y);
if (!Double.isNaN(value)) {
sum[p] += value;
count[p]++;
}
}
}
}
for (int y=0, p=0; y<h; y++)
for (int x=0; x<w; x++, p++)
ip.setf(x, y, (float)(sum[p]/count[p]));
ip.resetMinAndMax();
return projection;
}
Expand Down Expand Up @@ -864,5 +867,3 @@ public void postProcess() {
} // end StandardDeviation

} // end ZProjection


4 changes: 2 additions & 2 deletions ij/plugin/frame/RoiManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -980,8 +980,8 @@ boolean saveMultiple(int[] indexes, String path) {
RoiEncoder re = new RoiEncoder(out);
for (int i=0; i<indexes.length; i++) {
IJ.showProgress(i, indexes.length);
String label = (String)listModel.getElementAt(i);
Roi roi = (Roi)rois.get(indexes[i]);
String label = (String)listModel.getElementAt(indexes[i]);
if (IJ.debugMode) IJ.log("saveMultiple: "+i+" "+label+" "+roi);
if (roi==null) continue;
if (!label.endsWith(".roi")) label += ".roi";
Expand Down Expand Up @@ -1491,7 +1491,7 @@ boolean drawOrFill(int mode) {
if (roi==null) continue;
if (mode==FILL&&(type==Roi.POLYLINE||type==Roi.FREELINE||type==Roi.ANGLE))
mode = DRAW;
String name = (String) listModel.getElementAt(indexes[i]);
String name = (String)listModel.getElementAt(indexes[i]);
int slice2 = getSliceNumber(roi, name);
if (slice2>=1 && slice2<=imp.getStackSize()) {
imp.setSlice(slice2);
Expand Down
18 changes: 17 additions & 1 deletion release-notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</head>
<body>

<li> <u>1.54j15 15 April 2024</u>
<li> <u>1.54j22 24 May 2024</u>
<ul>
<li> Thanks to 'ramnoob', added a number of official tags
to the DICOM reader.
Expand All @@ -15,6 +15,9 @@
<li> Thanks to Gabriel Landini, ImageJ adds an "*" next to
the Mode value in the Histogram window if the histogram is
multi-modal.
<li> Thanks to Norbert Vischer, added the
setOption("MouseWheelStackScrolling",boolean) macro
function.
<li> Thanks to Albert Cardona and Curtis Rueden, added
public setEqualize() and setSaturated() methods to the
ContrastEnhancer class.
Expand All @@ -27,6 +30,19 @@
<li> Thanks to Stein Rorvik, fixed a bug where the
Table.getColumn() macro function did not work with
columns containing empty strings.
<li> Thanks to Norbert Vischer, fixed bug where
text fields in GenericDialogs opened after a showMessage()
were non-editable.
<li> Thanks to Jan Brocher, fixed bug where drag-and-drop of
directories onto GenericDialog directory fields did not
work as expected.
<li> Thanks to Norbert Vischer, fixed an Overlay.clear macro
function bug.
<Li> Thanks to Alexander Bender, fixed bug with ROI Manager
ignoring selection when saving.
<li> Thanks to Michael Schmid, fixed 1.53t regression
where Image&gt;Stacks&gt;Z Project</i> failed when doing
"Average" projection of 32-bit float stacks
</ul>

<li> <u>1.54i 03 March 2024</u>
Expand Down

0 comments on commit 6f6e828

Please sign in to comment.