Giter Club home page Giter Club logo

imagej's Introduction

ImageJ

ImageJ is public domain software for processing and analyzing scientific images.

It is written in Java, which allows it to run on many different platforms.

For further information, see:

Using ImageJ as a dependency

To use ImageJ as a library in your Maven project, add the dependency:

<dependency>
  <groupId>net.imagej</groupId>
  <artifactId>ij</artifactId>
  <version>1.53j</version>
</dependency>

Where 1.53j is the version of ImageJ you would like to use:

Building from source

With Ant

The Apache Ant utility will compile and run ImageJ using the build.xml file in this directory. There is a version of Ant at

https://imagej.nih.gov/ij/download/tools/ant/ant.zip

set up to use the JVM distributed with the Windows version of ImageJ. The README included in the ZIP archive has more information.

With Maven

You can compile and run ImageJ using the Maven build tool:

Command Action
mvn Compile and package ImageJ into a JAR file in the target directory.
mvn -Pexec Compile and then run ImageJ.
mvn javadoc:javadoc Generate the project Javadoc in the target/apidocs directory.

imagej's People

Contributors

bdezonia avatar ctrueden avatar dscho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

imagej's Issues

Interpreter.error(String) does not work headless

When running a macro as a headless script in ImageJ2, and the macro interpreter encounters an error, the ij.macro.Interpreter.error(String) method is called. Since ImageJ 1.51u, this method tries to copy the error to the system clipboard, which is not allowed in headless mode:

java.awt.HeadlessException
	at sun.awt.HeadlessToolkit.getSystemClipboard(HeadlessToolkit.java:309)
	at ij.macro.Interpreter.error(Interpreter.java:1234)
	at ij.macro.Interpreter.undefined(Interpreter.java:1764)
	at ij.macro.Interpreter.lookupVariable(Interpreter.java:1707)
	at ij.macro.Interpreter.getFactor(Interpreter.java:1498)
	at ij.macro.Interpreter.getTerm(Interpreter.java:1432)
	at ij.macro.Interpreter.getExpression(Interpreter.java:1415)
	at ij.macro.Interpreter.getBooleanExpression(Interpreter.java:1061)
	at ij.macro.Interpreter.getLogicalExpression(Interpreter.java:1037)
	at ij.macro.Interpreter.getAssignmentExpression(Interpreter.java:1158)
	at ij.macro.Interpreter.doAssignment(Interpreter.java:758)
	at ij.macro.Interpreter.doStatement(Interpreter.java:267)
	at ij.macro.Interpreter.doStatements(Interpreter.java:235)
	at ij.macro.Interpreter.run(Interpreter.java:118)
	at ij.macro.Interpreter.run(Interpreter.java:89)
	at ij.macro.Interpreter.run(Interpreter.java:100)
	at ij.plugin.Macro_Runner.runMacro(Macro_Runner.java:161)
	at ij.IJ.runMacro(IJ.java:138)
	at ij.IJ.runMacro(IJ.java:127)
	at net.imagej.legacy.IJ1Helper$3.call(IJ1Helper.java:1096)
	at net.imagej.legacy.IJ1Helper$3.call(IJ1Helper.java:1092)
	at net.imagej.legacy.IJ1Helper.runMacroFriendly(IJ1Helper.java:1043)
	at net.imagej.legacy.IJ1Helper.runMacro(IJ1Helper.java:1092)
	at net.imagej.legacy.plugin.IJ1MacroEngine.eval(IJ1MacroEngine.java:137)
	at org.scijava.script.ScriptModule.run(ScriptModule.java:160)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:168)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)
	at org.scijava.thread.DefaultThreadService$3.call(DefaultThreadService.java:238)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

This exception can be reproduced by creating a simple macro called hello.ijm with only the line hello (not a valid ImageJ macro command). Then running:

$FIJI_HOME/Contents/MacOS/ImageJ-macosx --ij2 --headless --run /path/to/hello.ijm

With ImageJ 1.51s, the following output is given:

Macro Error: Undefined variable in line 2.

<hello>

Whereas with 1.51u and newer, the above thread dump happens.

@rasband Personally, I would favor removing this auto-copying behavior completely, since I find it impolite to overwrite the user's clipboard in that way. But if the behavior is here to stay, then I suggest wrapping the clipboard logic in a try/catch block to avoid this issue. Otherwise, whenever a macro has a problem executing in headless mode, the user will receive this same exception instead of the intended error.

Zooming causes a crash

Hey there,
just noticed that the zooming function with "+" in the newest ImageJ version causes a crash after clicking "+" ~ 4 times.
OS is Mac OS X, 10.11.6, Java 8, Update 131 (seems to be the newest version) and ImageJ version 1.50i.
The image is a small 12x12 px image.

Maybe anyone of you can fix this bug.

Greetings,
Severin

Undo with pencil on a stack behaves strangely

Ran into this bug with @milkyklim today:

  • Create a new image with:
    newImage("Untitled", "8-bit ramp", 64, 64, 2);
  • Select the pencil tool and draw a squiggle.
  • Undo.
  • Draw another squiggle. The first squiggle reappears.

It works as expected with a 2D image.

Typing non-ASCII characters into a text ROI does not work

From an ImageJ forum post:

I am using ImageJ 1.50i on Ubuntu with Fcitx Chinese Input Method. The problem is that Chinese character can't either be added directly by the input method or be pasted into Text box from other editor. The input method can't be called out in both Text selection on image and Text Window from Plugins Menu. But the characters can be pasted into Text Window, so there is a indirect solution to add them by running Macro drawString("中文", 10, 80).

The typing problem is same for CJK characters, I guess.

Missing NullCheck in ImageJ1 ij.gui.PlotWindow.java line 720

I just stumbled across this error message when closing a live PlotWindow in ImageJ 1.51g

Exception in thread "Live Profiler" java.lang.NullPointerException
    at ij.gui.PlotWindow.run(PlotWindow.java:720)
    at java.lang.Thread.run(Thread.java:662)

I am not an ImageJ dev, but this new line should do the trick:

Plot plot = plotMaker!=null?plotMaker.getPlot():null;

[Point tool -> Label points] has no effect

I double click on the [Point tool], which opens the [Point tool] window. If I check or uncheck [Label points] option, it has no effect - the small labels are always drawn on the image.

The same is true for lines, rectangles and other objects...

I work with ImageJ 1.51h on Win7 64-bit.

Commands in the right-click popup menu do not get recorded

The macro recorder doesn't record commands launched from the popup menu (e.g. right-click > Rename... or right-click > Duplicate...), while the same commands do get recorded as expected when run from the main menu (Image > Rename... or Image > Duplicate...).

Take over ownership of the Chocolatey package

I'm the maintainer of the ImageJ package on Chocolatey, a Windows application package manager. It's a reasonably popular package, too!

https://chocolatey.org/packages/imagej

I'd love to see the team take over ownership so updates can be published in a more timely fashion. I can send a PR to the correct repository. I'm happy to provide documentation/training or whatever.

Let me know!

`ImageProcessor.isBinary` always returns `false`

The documentation of the method states "Returns 'true' if this is a binary image (8-bit-image with only 0 and 255)" whereas the whole body of the method is just:

public boolean isBinary() {
    return false;
}

Delete channel locks imagej

We believe we have found a bug in imagej (with Fiji):

With:

  • a 3 channel time-lapse image as the active window
  • The last channel as the active channel
  • The Channels tool open
  • Select Image->Stacks->Delete Slice is selected from the menu
  • Select channel from the dropdown menu

The channels tool will close and imagej will lock up and need to be forcibly closed.

This does not occur if a channel other than the last one is active.
I was able to reproduce this on Windows and Mac with a hyper-stack created with New Hyperstack.

Chris

AVI reading issue (indx/ix00 files)

There seems to be an issue with the AVI Reader. When opening a valid AVI file, AVI Reader states: "An error occurred reading the AVI file. Required item 'ix00' not found." And yet these files open fine with other software I have.

This collection of 2.5gb AVI files from a variety of sources are each typically comprised of 450 frames @ 30fps that internally use an 'indx' composed of 2 entries: a 410 frame 'ix00' and a 40 frame 'ix00'. The plugin will only read the first block of 410 frames based on the 'dwTotalFrames' value in the 'avih' header.

In the Java source for AVIReader, there's a comment "number of frames in ix00; ignored: not always trustworthy" in the 'readAVI2Index' function that is responsible for reading these 'dwDuration' values of 410 and 40.

Smaller files and larger files (eg. 4.7gb @ 900 frames) that don't use the 'indx'/'ix00' indexing schema work fine.

RescaleSlope/Intercept not applied for signed DICOM files by default

This has first been reported in 2011:
http://imagej.1557.x6.nabble.com/PET-images-read-incorrectly-td3685064.html

A Dicom file that has signed pixel data, Pixel Representation (0028,0103) == 1, does not have RescaleSlope/Intercept applied when loading in ImageJ, unless one explicitly checks "Edit - Options - DICOM - Open as 32-bit float". This is related to this piece of code:
https://github.com/imagej/imagej1/blob/master/ij/plugin/DICOM.java#L122

floating point issue in FloatStatistics.java

It may be a very rare corner case, but in FloatStatistics.java there are
float v;
and
double v;
used in different places for the same purpose of holding a temporary copy of a float pixel value and doing range checks. It appears that the use of "double v" in line 50 could lead to inconsistent pixelCounts and then in turn the float[] pixels2 array from line 230 maybe too short. In particular I got the very strange Error when setting the pixels in a 512x512 32bit image without any ROIs or masks.

Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 262143
at ij.process.FloatStatistics.getMedian(FloatStatistics.java:242)
at ij.process.FloatStatistics.(FloatStatistics.java:44)
at ij.process.ImageStatistics.getStatistics(ImageStatistics.java:82)
at ij.ImagePlus.getStatistics(ImagePlus.java:891)
at ij.ImagePlus.getStatistics(ImagePlus.java:863)
at ij.ImagePlus.getStatistics(ImagePlus.java:843)
at ij.plugin.frame.ContrastAdjuster.plotHistogram(ContrastAdjuster.java:610)
at ij.plugin.frame.ContrastAdjuster.setupNewImage(ContrastAdjuster.java:396)
at ij.plugin.frame.ContrastAdjuster.setup(ContrastAdjuster.java:317)
at ij.plugin.frame.ContrastAdjuster.setup(ContrastAdjuster.java:275)
at ij.plugin.frame.ContrastAdjuster.windowActivated(ContrastAdjuster.java:1149)
at java.awt.AWTEventMulticaster.windowActivated(AWTEventMulticaster.java:372)
at java.awt.Window.processWindowEvent(Window.java:1877)
at java.awt.Window.processEvent(Window.java:1823)
at java.awt.Component.dispatchEventImpl(Component.java:4652)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1850)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:910)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:409)
at java.awt.Component.dispatchEventImpl(Component.java:4524)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:603)
at java.awt.EventQueue$1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:617)
at java.awt.EventQueue$2.run(EventQueue.java:615)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
at java.awt.SentEvent.dispatch(SentEvent.java:55)
at java.awt.DefaultKeyboardFocusManager$DefaultKeyboardFocusManagerSentEvent.dispatch(DefaultKeyboardFocusManager.java:183)
at java.awt.DefaultKeyboardFocusManager.sendMessage(DefaultKeyboardFocusManager.java:210)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:286)
at java.awt.Component.dispatchEventImpl(Component.java:4524)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:603)
at java.awt.EventQueue$1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:617)
at java.awt.EventQueue$2.run(EventQueue.java:615)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
at java.awt.SequencedEvent.dispatch(SequencedEvent.java:101)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:642)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:603)
at java.awt.EventQueue$1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:617)
at java.awt.EventQueue$2.run(EventQueue.java:615)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

text tool problem

  1. text tool can not accept any Chinese or Japanese, English is good.

  2. text tool configure has some encode problem . please see screen shot link
    https://pan.baidu.com/s/1jIehyUa

Imagej version 1.51p
java1.8
windows 10 Professional simple chinense

feature request for Binner

Hi,

When running below ImageJ macro...

newImage("Untitled", "8-bit black", 256, 254, 11);
run("Bin...", "x=3 y=3 z=3 bin=Average");

... the resulting image has 3 z-planes, indicating that the Binner discards the information in slices 10 and 11 of the original data. One other choice of implementing the Binner would have been that the resulting image has 4 z-planes, where its 4th z-plane is computed from the information in planes 10 and 11 of the original data.

I feel both options are valid, for me personally at the moment the latter option would be better, in order to preserve all content of my data.

Would it be possible to add an option such that the user can choose between the two behaviors?

Lost LUT when convert from 32-bit to RGB Color

Hello,
I'm not sure whether this is actually a bug or something that is intended.
In imageJ v1.52e, when a 32-bit grayscale image with a LUT is converted to RGB Color, the colors are lost. This is not the case with 8-bit images and worked with 32-bit images up to v1.52d.
For reproduction:

  • File -> New -> Image... (Type: 32-bit or 8-bit, Fill with: Ramp)
  • Image -> Lookup Tables -> Fire (or somthing else)
  • Image -> Type -> RGB Color

ChannelSplitter creating a non-correct ImageStack object

Hi,

I was debugging a plugin for ImageJ we are writing and I found a possible problem with both ImageStack and ChannelSplitter classes.

The problem we have in the plugin is that we have hyper-stack (color-stack) that we want to process. We call ChannelSplitter to separate the colors into individual stacks so that we can process them. The problem is that at this point a getVoxel on the stack will return 0 for every pixel.

I had a look and it looks like ChannelSplitter creates ImageStacks objects with the type property set to -1 (UNDEFINED) although it should be byte. The getVoxel method check the type property and returns 0 all the time if the type is -1. Shouldn't an error be thrown at this point ? You get a zero and you do not realize what is going on.

I managed to make it work in my dev environment by changing the setType method of ImageStack from private to public and calling this after the channel splitting. This method would set the type accordingly to the bitdepth. Doing this fixes the issue but involves editing ImageStack.

Would you have any other suggestions ?

Elton

ImageCalculator.run method not accepting options

@mparada wrote:

ImageCalculator method run does not accept options. OTH, the deprecated method calculate does.

from ij import IJ
from ij.plugin import ImageCalculator

IJ.run("Blobs (25K)");
imp = IJ.getImage();

# this doesn't work
ImageCalculator().run("Subtract create", imp, imp) 

# these work
ImageCalculator().run("Subtract", imp, imp) # without options
ImageCalculator().calculate("Subtract create", imp, imp) # deprecated method

Migrated-From: scijava/scripting-jython#5

nothing, just look at imagej and you(Rasband) with reverence

I know imagej and Rasband in a book wrote by Wilhelm Burger and Mark Burge many years ago. and I became a big funs of imagej.

It's between ps, gimp and opencv. Programers can add plugins, then any no-programer can use it. And I also find something imperfect, eg. we must write algrithm pixel by pixel, and there is no criterion to write a plugin, so many algrithm are mixed in the plugin with ui, we can not call it somewhere other.

I know imagej team improve those in imagej2, and imagej2 implements many thought I think befor. It 's perfect. I see, the imagej1 also update now and then. could you tell me what you are doing on imagej1?

And in the past few years, I found python, and I like it's simple gramma, And there is so many liberies could be used, especially in imageprocess. scipy.ndimg, scikit-image, and the third-part libraries such as opencv, itk..., and many ml method, tesorflow, pytorch... and we can use matplotlib, vtk, mayavi draw beautiful 2d/3d figure esaily.(witch java do hardly). but there is no interactive framework like imagej, so only programer can use these. so in the last year, I wrote a pythonnic imagej called imagepy. I know imagej2 supports python and can glue with opencv, itk, but I think a pure python framework is more directly, all the liberies are based on Numpy, So the framework could be build esaily, and extended esaily.

I wrote to you to thanks your work, witch leed me go forward. and if you have time, have a look imagepy. then give me some advice what to do next.
At last, may I venture to invite you join imagepy orgnization?

Programmatically generated overlay of PointRois not shown when file saved and reopened if stack has > 1 slice

To reproduce this odd behaviour:

  1. run the javascript below (adapted from @rasband in #67 (comment))

  2. notice the PointRois

  3. save and close file

  4. reopen file
    5. notice that the PointRois are not shown; they are however still present in the overlay as shown by Overlay>List elements

  5. now repeat the above but reduce the stack size from 2 to just 1 slice (i.e. set d = 1)
    7. notice that the PointRois are now visible!

  6. repeat steps 1-2 and then manually add a few points with the multi-point tool

  7. save and close file

  8. reopen file
    11. notice that the programmatically generated points are not shown, while those added manually are shown!

importClass(java.util.Random);
importClass(Packages.java.awt.Color);
importClass(Packages.ij.IJ);
importClass(Packages.ij.gui.Overlay);
importClass(Packages.ij.gui.PointRoi);
 
var	w = 500, h = 500, d = 2,
img = IJ.createImage("Demo","8-bit black",w,h,d),
overlay = new Overlay();
 
 img.setOverlay(overlay);
 img.show(); 
 ran = new Random();

 for (var i = 1; i <= d; i++) {
   var roi = new PointRoi();
   for (var j = 0; j < 5; j++) {
     x = ran.nextFloat()*w;
     y = ran.nextFloat()*h;
     roi.addPoint(x,y);
  }
  roi.setPosition(i);
  roi.setStrokeColor(new Color(200, 255, 100));
  roi.setPointType(3);
  roi.setSize(4);
  roi.setShowLabels(false);
  overlay.add(roi);
} 

Effects of setColor() on ByteProcessor vs. ColorProcessor

It appears that the setColor() method does not consider RGB component weights properly when setting the associated (i.e., gray) draw value for ByteProcessor. Drawing operations should yield the same brightness values when (a) drawing to a grayscale image or (b) drawing to a color image and subsequently converting to a grayscale image. However, results are vastly different.

The following plugin demonstrates this behavior: the values in bp should be the same as in the converted color image cpc. Test images are attached.

import java.awt.Color;

import ij.ImagePlus;
import ij.plugin.PlugIn;
import ij.process.ByteProcessor;
import ij.process.ColorProcessor;
import ij.process.ImageProcessor;

public class Color_Draw_Test implements PlugIn {
	static int width = 200;
	static int height = 200;
	
	static Color circleColor = Color.blue;
	static Color backgroundColor = Color.cyan;

	@Override
	public void run(String arg0) {

		ImageProcessor cp = new ColorProcessor(width, height);
		ImageProcessor bp = new ByteProcessor(width, height);
		cp.setColor(backgroundColor); cp.fill();
		bp.setColor(backgroundColor); bp.fill();
		
		cp.setColor(circleColor);
		cp.fillOval(25, 50, 150, 100);
		
		bp.setColor(circleColor);
		bp.fillOval(25, 50, 150, 100);
		
		ImageProcessor cpc = cp.convertToByteProcessor();

		new ImagePlus("cp", cp).show();
		new ImagePlus("cpc", cpc).show();
		new ImagePlus("bp", bp).show();
	}
}

If this is agreed to need fixing I'd be happy to look into it.
--Wilhelm

cp cp
cpc cpc
bp bp

Cannot save pasted image content in javascript

After copy/pasting programmatically the content within a rectangular ROI from one location to another of the same image and saving, the saved file does not include this modification! Saving the image manually instead does embed the copied pixels. The issue can be replicated with the following:

importClass(Packages.ij.IJ);
importClass(Packages.ij.ImagePlus);
importClass(Packages.ij.gui.NewImage);
importClass(Packages.ij.gui.Roi);
 
var image = NewImage.createRGBImage(“Untitled”, 1000, 500, 1, NewImage.FILL_RAMP);
var rectRoi = new Roi(parseFloat(500), parseFloat(0), parseFloat(500), parseFloat(250)); image.setRoi(rectRoi);
image.copy(false);
rectRoi.setLocation(parseFloat(0), parseFloat(0));
image.paste();
image.show();
IJ.saveAsTiff(image, “[your favourite directory path here]/temp.tif”);

I’ve tried different variants of the same methods without success. See also forum discussion http://forum.imagej.net/t/help-with-saving-pasted-image-content-in-javascript/12146

Problem with rasterization of line and point ROIs

When I used the point iterator on line and point ROIs I found that the obtained point coordinates are often wrong. In particular,

  • the terminal points of lines are not rendered correctly,
  • some consecutive line points have duplicates with identical positions,
  • coordinates of points in single and multi-point ROIs are generally off by one pixel.

Test images (containing selected ROIs) can be found here (tried to attach a ZIP file but it was rejected).

In this course I also looked at the behavious of Line.getPixels() and found similar deficiencies. The end point of the line was never included and the resulting array of pixel values also contained duplicates from the same locations (which I believe is not intended). However, even when interpolation is ON, the getPixels() method missed the last point on the line.

The mapping from float or double to int coordinates is apparently flawed in several places. I suggest to use this version to calculate the right offset (which will also work for negative coordinates):

double x, y;  // original position
int u = (int) Math.round(x - 0.5);
int v = (int) Math.round(y - 0.5);

Perhaps this should be packed into a single conversion method. There may be related problems in other places.

I have worked out a patch which can be found in this repo. Will send a pull request shortly. Hope this is useful, pls. let me know if anything's unclear.

--Wilhelm

PS: The announced pull request is here.

Bug Plot Font

I detected a Linux bug (fresh Ubuntu 18.10 install on VirtualBox) in the ij.util.FontUtil class if used from the ij.gui.Plot class.
The bug occurs when a Plot macro is executed.
On my Linux system the default Plot font "Arial" is not available and leads to the following exception:

ImageJ 1.52i35; Java 11.0.1 [64-bit]; Linux 4.18.0-11-generic; 114MB of 1026MB (11%)
 
java.lang.StackOverflowError
	at java.base/java.lang.String.toLowerCase(String.java:2503)
	at java.desktop/sun.font.SunFontManager.findFont2D(SunFontManager.java:1937)
	at java.desktop/sun.font.SunFontManager.getDefaultLogicalFont(SunFontManager.java:1106)
	at java.desktop/sun.font.SunFontManager.findFont2D(SunFontManager.java:2290)
	at java.desktop/java.awt.Font.getFont2D(Font.java:506)
	at java.desktop/java.awt.Font.getFamily(Font.java:1410)
	at java.desktop/java.awt.Font.getFamily_NoClientCode(Font.java:1384)
	at java.desktop/java.awt.Font.getFamily(Font.java:1376)
	at ij.util.FontUtil.getFont(FontUtil.java:14)
	at ij.util.FontUtil.getFont(FontUtil.java:16)

One solution is the iterate over available fonts in the Fontutil.class, e.g.:

public static Font getFont(String fontFamilyName, int style, float size) {
		String fonts[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
		boolean fontAvail = false;
		for (int i = 0; i < fonts.length; i++) {
			if (fonts[i].startsWith(fontFamilyName)) {
				fontAvail = true;
			}
		}
		if (fontAvail == false) {
			// see https://stackoverflow.com/questions/7140248/get-system-default-font/11592041#11592041
			Font font = new Font(new JLabel().getFont().getFontName(), style, (int) size);
			return (font);
		}
		Font font = new Font(fontFamilyName, style, (int) size);
		if (!font.getFamily().startsWith(fontFamilyName)) {
			String[] similarFonts = getSimilarFontsList(fontFamilyName);
			font = getFont(fontFamilyName, style, (int) size);
		}
		if (size != (int) size)
			font = font.deriveFont(size);
		return font;
	}

BatchConverter on Mac

Hi, I'm having some trouble with Process → Batch → Convert... running on a Mac.

Specially, if I press a button to set the input or output directory, and choose a valid directory, the plugin immediately runs - with no opportunity to change the other directory, or to run it again after I have made further changes.

I believe it's because of this code inside actionPerformed:

if (IJ.isMacOSX())
   {gd.setVisible(false); gd.setVisible(true);}

This then results in the showDialog() method above proceeding too early beyond gd.showDialog();.

ImageStatistics getStatistics API

This change: 3740ec9#diff-6f1421fe86889bb3a171a110c60adf57R839
breaks the API of ImageStatistics. Namely, getStatistics() without arguments now doesn't calculate some of the statistics (e.g. xCenterOfMass) that it previously did. These values are left undefined. I have a longstanding plugin that assumed getStatistics() would run with ALL_STATS and it was broken in a rather hard-to-debug way because of this change. I'm guessing others might be affected.

Resetting the RoiManager from a scirpt crashes if the RoiManager was already open

# This ImageJ python script crashes if the RoiManager is open when it is run
from ij.plugin.frame import RoiManager
roimgr = RoiManager()
roimgr.reset()

As the comment says, this python script works fine if the RoiManager is not open when it is run,
but crashes if the RoiManager was already open when the script is run.

This is the resulting error:

Started buggy.py at Tue Oct 03 23:57:46 EDT 2017
Traceback (most recent call last):
  File "~/buggy.py", line 4, in <module>
    roimgr.reset()
	at ij.plugin.frame.RoiManager.reset(RoiManager.java:2066)
	at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)

java.lang.NullPointerException: java.lang.NullPointerException

	at org.python.core.Py.JavaError(Py.java:546)
	at org.python.core.Py.JavaError(Py.java:537)
	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:188)
	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204)
	at org.python.core.PyObject.__call__(PyObject.java:461)
	at org.python.core.PyObject.__call__(PyObject.java:465)
	at org.python.core.PyMethod.__call__(PyMethod.java:126)
	at org.python.pycode._pyx48.f$0(~/buggy.py:4)
	at org.python.pycode._pyx48.call_function(~/buggy.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:167)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.Py.runCode(Py.java:1386)
	at org.python.core.__builtin__.eval(__builtin__.java:497)
	at org.python.core.__builtin__.eval(__builtin__.java:501)
	at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:259)
	at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:40)
	at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:31)
	at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
	at org.scijava.script.ScriptModule.run(ScriptModule.java:159)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:167)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:126)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:65)
	at org.scijava.thread.DefaultThreadService$3.call(DefaultThreadService.java:237)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
	at ij.plugin.frame.RoiManager.reset(RoiManager.java:2066)
	at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)
	... 24 more

(file paths redacted)

PlugInFilterRunner breaks Undo for single-image TYPE_CONVERSION

From @mountain-maennlein on May 9, 2018 18:7

PlugInFilterRunner breaks Undo for certain code paths.

I am looking at the code in PlugInFilterRunner.java, from:

https://imagej.nih.gov/ij/developer/source/ij/plugin/filter/PlugInFilterRunner.java.html

It appears that the bug is in line 115. Lines 115--120 of the code are:

                if ((flags&PlugInFilter.NO_CHANGES)==0) {   // (filters doing no modifications don't change undo status)
                    if (snapshotDone)
                        Undo.setup(Undo.FILTER, imp);
                    else
                        Undo.reset();
                }

Line 115 tests for PlugInFilter.NO_CHANGES NOT being set, which means
that the plugin has stated that it WILL (at least potentially) change
the image. If the condition tests true (that is, NO_CHANGES is not set),
then the subsequent lines incorrectly clear the Undo information.

I do not understand all of the code paths here, but, simplistically,
it would appear that replacing line 115 with:

                if ((flags&PlugInFilter.NO_CHANGES)!=0) {   // (filters doing no modifications don't change undo status)

would fix the bug.

As a workaround, a (single-image) TYPE_CONVERSION PlugInFilter can
return, e.g.:

   return DOES_8G | NO_CHANGES;

from its setup() method (falsely saying that it won't change the
image), in effect, reversing the incorrect NO_CHANGES test in
PlugInFilterRunner, and preventing PlugInFilterRunner from clearing
the Undo information.

Here is code for a plugin that illustrates the bug and the
workaround (but not the proposed actual fix):

// PlugInFilterUndo.java

// contents of plugins.config file:
//
// MM, "PlugInFilterUndo", mm.PlugInFilterUndo("")
// MM, "PlugInFilterUndo -- NO_CHANGES", mm.PlugInFilterUndo("NO_CHANGES")

package mm;

import ij.ImagePlus;
import ij.Undo;
import ij.plugin.filter.PlugInFilter;
import ij.process.ImageProcessor;
import ij.process.ShortProcessor;

/**
 * example for broken undo in PlugInFilterRunner
 */

public class PlugInFilterUndo implements PlugInFilter {

  private ImagePlus imp = null;

  public int setup (String arg, ImagePlus image) {
    imp = image;  // remember image for run method
    if (arg.equals ("NO_CHANGES"))  return DOES_8G | NO_CHANGES;
    else                            return DOES_8G;
  }

  public void run (ImageProcessor ip) {
    ShortProcessor sp = imp.getProcessor().convertToShortProcessor();
    short pixels[] = (short[]) sp.getPixels();
    for (int i = 0; i < pixels.length; i++)
      pixels[i] = (short) (((i / 32) % 2 == 0) ? 16384 : 49152);
    Undo.setup (Undo.TYPE_CONVERSION, imp);
    imp.setProcessor (sp);
    return;
  }

}

To run this code, build and install the plugin (including the
plugins.config given as comments in the above java code.) Then
open (or create) an 8-bit image and run the command:

MM > PlugInFilterUndo -- NO_CHANGES

This version uses the "NO_CHANGES" workaround, and will convert
the image to a 16-bit image (and change the values of the pixels).
Now running:

Edit > Undo

will revert the image back to the 8-bit original.

Contrariwise, running the version without the workaround:

MM > PlugInFilterUndo

will perform the same conversion to a 16-bit image, but, because
of the PlugInFilterRunner bug, subsequently running:

Edit > Undo

will now not work.

This is all analyzed and tested with:

ImageJ 2.0.0-rc-65/1.52b; Java 1.8.0_66 [64-bit]; Linux 4.4.0-121-generic;

on:

ubuntu 16.04 LTS, 64-bit

Thanks, mm

Copied from original issue: imglib/imglib2-ij#15

"Compile and Run" problem with Java 9

Testing ImageJ1 (1.51u) with Java 9 (jre-9.0.4), I noticed that Compile and Run is not working for plugins defined in a package other than the default package. In this case a StackOverflowError is shown:

Exception in thread "My_First_Plugin" java.lang.StackOverflowError
	at java.base/java.io.WinNTFileSystem.normalizePrefix(Unknown Source)
	at java.base/java.io.WinNTFileSystem.normalize(Unknown Source)
	at java.base/java.io.WinNTFileSystem.normalize(Unknown Source)
	at java.base/java.io.File.<init>(Unknown Source)
	at java.base/jdk.internal.loader.URLClassPath$FileLoader.<init>(Unknown Source)
	at java.base/jdk.internal.loader.URLClassPath$3.run(Unknown Source)
	at java.base/jdk.internal.loader.URLClassPath$3.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/jdk.internal.loader.URLClassPath.getLoader(Unknown Source)
	at java.base/jdk.internal.loader.URLClassPath.getLoader(Unknown Source)
	at java.base/jdk.internal.loader.URLClassPath.getResource(Unknown Source)
	at java.base/java.net.URLClassLoader$1.run(Unknown Source)
	at java.base/java.net.URLClassLoader$1.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.net.URLClassLoader.findClass(Unknown Source)
	at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
	at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
	at ij.plugin.PlugInExecuter.runCompiledPlugin(Compiler.java:335)
	at ij.plugin.PlugInExecuter.runCompiledPlugin(Compiler.java:357)
	at ij.plugin.PlugInExecuter.runCompiledPlugin(Compiler.java:357)
	at ij.plugin.PlugInExecuter.runCompiledPlugin(Compiler.java:357)
	at ij.plugin.PlugInExecuter.runCompiledPlugin(Compiler.java:357)
	at ij.plugin.PlugInExecuter.runCompiledPlugin(Compiler.java:357)
        ...

This is the same on Windows7 and MacOs. Compile and run works fine as long as the plugin class is in the default package. The problem appears only when the plugin is defined inside a package (subfolder). In this case, ImageJ's class loader appears to delegate class loading recursively, until the Java stack is full and the runtime crashes.

Imagestack.getVoxel()

Hi,

I was working with the class ImageStack.java and by chance I was getting some strage values (0) for some indexes. I realised that my indexes were going beyond the limits of the stack in the X,Y direction and the values returned where all 0. I was wondering if this was a design choice or a bug ? Shouldn't an error be through? Something like this java.lang.IndexOutOfBoundsException?

Elton

How to get the standard error of fit parameters with CurveFitter.java

Not really an issue folks, but wondering if someone knows how to get the standard error of the fit parameters with the CurveFitter class. It does a great job of fitting. I can easily get the sum of the residuals, R^2, the array of residuals, etc.... But have not found an easy way to get the standard error of the fit params. Can anyone guide me?

Thanks to everyone for continued support of this software!

Roundtrip to/from TIFF alters ROI slice positions

Here is an example macro illustrating the problem:

run("Mitosis (26MB, 5D stack)");
makeRectangle(39, 43, 29, 29);
roiManager("Add");
Stack.setPosition(2, 1, 1); // jump to channel 2
makeRectangle(77, 86, 50, 49);
roiManager("Add");
run("Select None");
run("From ROI Manager");
home = call("java.lang.System.getProperty", "user.home");
path = home + "/mitosis-with-overlay.tif";
print("Saving TIFF with overlay to: " + path);
saveAs("Tiff", path);
run("Close All");
open(path);
run("To ROI Manager");
roiManager("Show None");
roiManager("Select", 1);

The expected behavior is that the 2nd channel should be active, not the 2nd Z position.

ImageJ-1.51k plugins, URLs, LICENSE

Dear Wayne,
I would like to prepare a package of ImageJ for Gentoo Linux but It is difficult to find the source code of plugins. There used to exist http://rsb.info.nih.gov/ij/download/zips/ but there is no file for 1.50 release. Further, the listing at http://imagej.net/download/zips/ is even more outdated.

It appears I can get the plugins from http://wsr.imagej.net/distros/cross-platform/ files. Is that the right place?

I have system-wide installed jython. Can the code in the below files respect my system-wide jython installation instead of re-fetching its own copy? (sorry, I am a bit lazy now to read the relevant code to see what it is actually needed for)
plugin/frame/Editor.java
plugin/PlugInInterpreter.java
plugin/Macro_Runner.java

I think the page http://imagej.net/download.html lacks a link where to downloadable separate plugin zip files for a given imagej1 version.

Similarly, the page http://imagej.net/plugins/index.html lacks a Download section/pointer.

The page https://imagej.nih.gov/ij/source/ seems to contain a 1.51j version only and the plugins/ subdirectory seems incomplete. Or containing just core plugins?

It would be helpful if the *.zip files contained a plaintext file called LICENSE with the actual license text. Reading https://imagej.net/Licensing does not ensure me ImageJ-1.51j is actually https://choosealicense.com/licenses/bsd-2-clause/ .

Thank you for your help,
Martin

Odd-width AVI files don't load

When I attempt to load the attached 1703x64 (24-bit) AVI file, I receive an error.
An error occurred reading the AVI file.
Data chunk size 326976 too short (327168 required).

1703W * 64H * 3 bytes/pixel = 326976 bytes
1704W * 64H * 3 bytes/pixel = 327168 bytes

And yet the file loads fine with other video players.

Does this mean that any and all odd-width AVI files won't load within ImageJ?

Flashing AVI_1703x64_30s.avi.zip

Spline fitting an ANGLE Roi

Hello!

I noticed that when you try to spline fit an ANGLE Roi, it results in a closed Roi (see below images). Is this intended behavior? @rasband please let me know your thoughts on this.

ANGLE Roi
angle-roi

Spline Fit ANGLE Roi
spline-fit-angle-roi

Thank you very much,

Alison

trueEdmHeight

Hello! I have been reading the MaximumFinder code for some inspiration, and found the trueEdmHeight function (I also report it below for convenience). I was wondering if someone could provide a bit of insight on the rationale behind it, especially these bits:

For simplicity, we don't care about the Sqrt(5) distance here although this would be more accurate
float trueH = v + 0.5f*SQRT2;           //true height can never by higher than this
if (v>=v1 && v>=v2) {
    ridgeOrMax = true;
    h = (v1 + v2)/2;
} else {
    h = Math.min(v1, v2);
}
h += (d%2==0) ? 1 : SQRT2;          //in diagonal directions, distance is sqrt2

Also, I do not understand why the value is changed if the point of interest is a ridge or max in any direction, but its value is replaced by the largest trueH, which might be from a direction where the point is not a ridge/max. Or maybe this scenario is actually not possible and I am missing the whole point?

Sorry for the naive question(s). I am particularly interested in understanding this as it looks like a great improvement when using float EDM (the number of local maxima is nicely reduced, at least in my study cases).

Well, many thanks in advance!
Cheers :)


   /** Get estimated "true" height of a maximum or saddle point of a Euclidian Distance Map.
     * This is needed since the point sampled is not necessarily at the highest position.
     * For simplicity, we don't care about the Sqrt(5) distance here although this would be more accurate
     * @param x     x-position of the point
     * @param y     y-position of the point
     * @param ip    the EDM (FloatProcessor)
     * @return      estimated height
     */
    float trueEdmHeight(int x, int y, ImageProcessor ip) {
        int xmax = width - 1;
        int ymax = ip.getHeight() - 1;
        float[] pixels = (float[])ip.getPixels();
        int offset = x + y*width;
        float v =  pixels[offset];
        if (x==0 || y==0 || x==xmax || y==ymax || v==0) {
            return v;                               //don't recalculate for edge pixels or background
        } else {
            float trueH = v + 0.5f*SQRT2;           //true height can never by higher than this
            boolean ridgeOrMax = false;
            for (int d=0; d<4; d++) {               //for all directions halfway around:
                int d2 = (d+4)%8;                   //get the opposite direction and neighbors
                float v1 = pixels[offset+dirOffset[d]];
                float v2 = pixels[offset+dirOffset[d2]];
                float h;
                if (v>=v1 && v>=v2) {
                    ridgeOrMax = true;
                    h = (v1 + v2)/2;
                } else {
                    h = Math.min(v1, v2);
                }
                h += (d%2==0) ? 1 : SQRT2;          //in diagonal directions, distance is sqrt2
                if (trueH > h) trueH = h;
            }
            if (!ridgeOrMax) trueH = v;
            return trueH;
        }
    }

IJMath class missing in repo

Hello Wayne,

I just updated my application to the latest commit and didn't find the referenced ij.util.IJMath class used in the CurveFitter.

Show status when creating new stack

Hi Wayne,

Is it possible to remove, or better use a verbose option, the ShowStatus call in NewImage.CreateStack ? I use it a lot, and in a loop, in my 3D suite, and I would prefer not to show so many text ;) . Thanks a lot.

Thomas

Macro language's return statement issue

Hello everyone,

I wonder if this is a well known fact and accepted behavior from ImageJ macro language that the return statement works fine with parenthesis for numbers but not for strings :

function fooString(){
	return ("test") ;
}
function fooNumber(){
	return (1) ;
}
print("result String",fooString() ,"result Number", fooNumber());

This outputs result String 0 result Number 1, whereas :

function fooString(){
	return "test" ;
}
function fooNumber(){
	return 1 ;
}
print("result String",fooString() ,"result Number", fooNumber());

outputs result String test result Number 1

Even more puzzling to me is that

function fooString(){
	return ("123") ;
}
s=fooString();
print(s,(s+2));

this actually ouputs 123 125 so if the string represents a number it actually ouputs the number represented and not the string representing it.

It is not a big deal as long as the user knows it, but I wonder if there is a simple way to fix this by either making the return( var ); syntax throw an exception or ideally make this syntax work.

All keyboard shortcuts are duplicated on latest Fiji update - OSX

Running ImageJ 2.0.0-rc-62/1.51s / Java 1.8.0_66 (64-bit) on a OS X Yosemite 10.10.5...
Duplicate measurements are made only the first time ‘command+M’ is used… afterwards, single measurements are calculated. Also - this does not appear to occur with the ‘M’ shortcut alone - then it is also single measurements. This issue was originally posted on the ImageJ Forum here.

ImageProcessor.setLineWidth() method not overriding Fiji preferences

I am not able to override programmatically the value stored in the Fiji Edit/Options/Line width menu. Specifically, my task involves javascript to permanently draw the outline of a ROI in an image. To replicate:

importClass(Packages.ij.gui.NewImage);
importClass(Packages.ij.gui.Roi);
importClass(Packages.java.awt.Color);

var image = NewImage.createRGBImage(“Untitled”, 500, 500, 1, NewImage.FILL_BLACK);
var roi = new Roi(100, 100, 300, 300);
image.getProcessor().setColor(new Color(255, 0, 0));
image.getProcessor().setLineWidth(50);
image.getProcessor().draw(roi);
image.killRoi();
image.show();

The problem is that while the red color is correctly applied, the line width of 50 is not. The actual line width used is that stored manually in the Fiji menu. See also forum discussion http://forum.imagej.net/t/imageprocessor-setlinewidth-method-not-overriding-fiji-preferences/12169/2

Fiji>Image>Overlay>List elements returns only the first 63 independent points of many more

The issue came up with an output file of Alex Herbert's FindFoci plugin, when using the option to label maxima as overlay points. In particular I have an image with 300 points, but the List elements command in Fiji returns only the first 63!

0	null	Point	126	4851	1	1	cyan	yellow	1	14	0	14	0
1	null	Point	123	5721	1	1	cyan	yellow	1	18	0	18	0
2	null	Point	1409	1256	1	46	cyan	yellow	1	21	0	21	0
3	null	Point	1409	1212	1	1	cyan	yellow	1	22	0	22	0
4	null	Point	18	3805	1	1	cyan	yellow	1	24	0	24	0
5	null	Point	117	5728	1	1	cyan	yellow	1	27	0	27	0
6	null	Point	539	5791	1	1	cyan	yellow	1	40	0	40	0
7	null	Point	20	1940	1	1	cyan	yellow	1	43	0	43	0
8	null	Point	108	4858	1	1	cyan	yellow	1	44	0	44	0
9	null	Point	257	4857	622	146	cyan	yellow	1	47	0	47	0
10	null	Point	606	1135	804	3826	cyan	yellow	1	48	0	48	0
11	null	Point	621	5029	1	1	cyan	yellow	1	49	0	49	0
12	null	Point	485	5039	264	21	cyan	yellow	1	50	0	50	0
13	null	Point	637	4914	216	878	cyan	yellow	1	51	0	51	0
14	null	Point	508	5146	1	1	cyan	yellow	1	53	0	53	0
15	null	Point	1401	3387	3	44	cyan	yellow	1	54	0	54	0
16	null	Point	496	5389	1	1	cyan	yellow	1	55	0	55	0
17	null	Point	17	3387	21	456	cyan	yellow	1	56	0	56	0
18	null	Point	19	209	308	2533	cyan	yellow	1	57	0	57	0
19	null	Point	17	2702	613	2692	cyan	yellow	1	58	0	58	0
20	null	Point	155	4531	1	1	cyan	yellow	1	59	0	59	0
21	null	Point	18	1847	624	3524	cyan	yellow	1	61	0	61	0
22	null	Point	158	3965	1188	1632	cyan	yellow	1	62	0	62	0
23	null	Point	81	4255	99	307	cyan	yellow	1	63	0	63	0
24	null	Point	147	3921	1257	562	cyan	yellow	1	64	0	64	0
25	null	Point	143	3898	1214	683	cyan	yellow	1	65	0	65	0
26	null	Point	55	3878	1307	658	cyan	yellow	1	66	0	66	0
27	null	Point	21	1548	1390	2697	cyan	yellow	1	67	0	67	0
28	null	Point	68	924	1341	3676	cyan	yellow	1	68	0	68	0
29	null	Point	105	4387	143	606	cyan	yellow	1	69	0	69	0
30	null	Point	70	4279	76	241	cyan	yellow	1	70	0	70	0
31	null	Point	21	1752	230	4005	cyan	yellow	1	71	0	71	0
32	null	Point	35	4179	235	879	cyan	yellow	1	72	0	72	0
33	null	Point	18	1515	1393	4187	cyan	yellow	1	73	0	73	0
34	null	Point	19	1867	108	2508	cyan	yellow	1	74	0	74	0
35	null	Point	150	4825	1004	218	cyan	yellow	1	75	0	75	0
36	null	Point	89	4411	134	1382	cyan	yellow	1	76	0	76	0
37	null	Point	14	3757	1108	1624	cyan	yellow	1	77	0	77	0
38	null	Point	15	4249	226	1544	cyan	yellow	1	78	0	78	0
39	null	Point	30	4243	192	1550	cyan	yellow	1	79	0	79	0
40	null	Point	84	4737	1049	1056	cyan	yellow	1	80	0	80	0
41	null	Point	29	4019	184	1625	cyan	yellow	1	81	0	81	0
42	null	Point	12	1338	1399	4040	cyan	yellow	1	82	0	82	0
43	null	Point	20	4336	181	1425	cyan	yellow	1	83	0	83	0
44	null	Point	17	3866	1129	1916	cyan	yellow	1	84	0	84	0
45	null	Point	13	4253	215	1459	cyan	yellow	1	85	0	85	0
46	null	Point	75	4346	1098	1416	cyan	yellow	1	86	0	86	0
47	null	Point	18	3705	186	2073	cyan	yellow	1	87	0	87	0
48	null	Point	18	3823	156	1868	cyan	yellow	1	88	0	88	0
49	null	Point	18	3739	219	2040	cyan	yellow	1	89	0	89	0
50	null	Point	64	4854	173	905	cyan	yellow	1	90	0	90	0
51	null	Point	18	3837	211	1941	cyan	yellow	1	91	0	91	0
52	null	Point	18	3848	168	1944	cyan	yellow	1	92	0	92	0
53	null	Point	43	4841	198	906	cyan	yellow	1	93	0	93	0
54	null	Point	98	4918	566	703	cyan	yellow	1	94	0	94	0
55	null	Point	17	3882	113	1803	cyan	yellow	1	95	0	95	0
56	null	Point	132	5382	46	313	cyan	yellow	1	96	0	96	0
57	null	Point	145	4990	514	733	cyan	yellow	1	97	0	97	0
58	null	Point	10	5617	145	80	cyan	yellow	1	98	0	98	0
59	null	Point	170	4848	92	881	cyan	yellow	1	99	0	99	0
60	null	Point	21	5301	145	455	cyan	yellow	1	100	0	100	0
61	null	Point	153	5358	67	402	cyan	yellow	1	101	0	101	0
62	null	Point	724	5334	1	1	cyan	yellow	1	105	0	105	0

Convolver class on floating point image data

Hi,

We are working on a plugin for ImageJ and while using some of the built-in classes of ImageJ I found an issue with the class ij/plugin/filter/Convolver.java. What I was trying to do is to apply a 2D convolution with a 2D filter and I was calling the method convolveFloat from the class Convolver.java. However it doesn't perform the convolution as it try to get get a ROI from the image if the image doesn't have a ROI defined it doesn't get into the loops performing the convolution.

It's OK if you run it from the ImageJ interface because it goes through a roiReset and set's the ROI to to the entire image. However if you instantiate a Convolver object from inside another class you need to call roiReset before. I guess it is useful to keep the ROI in case you want to run the convolution in a specific ROI but maybe if there is no ROI the reset should be done automatically or indicate it in method documentation that the user should do it.

Elton

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.