Hi, I am new to ImageJ. I wanted to find differences between any two images taken from different angles. I have to do this in headless(non-GUI) mode using some programming language to run commands. For this I am registering/aligning the two images and then finding the differences. I could not find any plugin in ImageJ which would do both the tasks. I am using the plugin bUnwarpJ to register the images first. I am using the command line option "java -Xmx512m -classpath F:\ImageJ\jars\ij.jar;F:\ImageJ\plugins\bUnwarpJ_.jar bunwarpj.bUnwarpJ_ -align F:\ImageJ\P3g.jpg NULL F:\ImageJ\P4g.jpg NULL 0 0 0 0.1 0.1 1 10 temp1.tif temp2.tif" The output files are in tiff format. For finding differences between the source image and the registered image I did not find any feature/tool in ImageJ, I am doing this using the compare command of ImageMagick(im4java). (compare -metric AE -fuzz 20% P3g.jpg temp2.tif difference.jpg) I am not sure if this is a good idea. The compare command does not produce correct results if I compare tiff format registered output file and a jpeg image file. So I wanted to change the output file format produced by bUnwarpJ to a jpeg file. How can I do this using commandline? I tried "java -Xmx512m -classpath F:\ImageJ\jars\ij.jar;F:\ImageJ\plugins\bUnwarpJ_.jar bunwarpj.bUnwarpJ_ -align F:\ImageJ\P3g.jpg NULL F:\ImageJ\P4g.jpg NULL 0 0 0 0.1 0.1 1 10 temp1.jpg temp2.jpg" but it generates invalid file which cannot be opened. I dont know if I whatever I am doing is right. Any help will be appreciated. Thanks in advance. |
Hi Jaykris,
I am not familiar with the command line interface, but why not convert all of your images to tiff format before registering & comparing, that way you would be comparing tiffs with tiffs. For comparing images via the ImageJ GUI, you could try subtracting the two registered images via Process > Image Calculator to generate a 'difference' image. I don't know if you can access Image Calculator from the command line though. Cheers, Tim |
Dear Tim, Thank you for writing! I thought about that. But there is a problem with the tif files generated by bUnwarpJ. The tiff image files are blank when opened with any photo viewing software like mspaint. When opened with picasa it says invalid image file. But when opened with ImageJ I can see the proper image. It is because of this I am having a problem comparing tiff images generated by bUnwarpJ with other softwares. But if I save the generated tif file as jpg and the compare images using other softwares the results are fine. These jpg files can also be seen properly with mspaint and other applications. Is there any command line which can be used to do a save as from tiff to jpeg? Thanks, Kind Regards, Jay |
Hi Jay
I assume that is because the .tif is not 8bit and many programs (office etc) struggle to display them correctly. Please be careful using the 8bit format (.jpg or 8bit tif etc) for analysis. I find it best to only save my 'show' images with jpg etc. I suggest a simple macro to duplicate all the .tifs in a folder as a .jpg, then you have both. I don't know the command line sorry. Kenton Kenton Arkill GB U23 Ladies' Underwater Hockey Coach On 12 Jun 2012, at 12:34, Jaykris wrote: > Dear Tim, > > Thank you for writing! > > I thought about that. But there is a problem with the tif files generated by > bUnwarpJ. The tiff image files are blank when opened with any photo viewing > software like mspaint. When opened with picasa it says invalid image file. > But when opened with ImageJ I can see the proper image. It is because of > this I am having a problem comparing tiff images generated by bUnwarpJ with > other softwares. > > But if I save the generated tif file as jpg and the compare images using > other softwares the results are fine. These jpg files can also be seen > properly with mspaint and other applications. > > Is there any command line which can be used to do a save as from tiff to > jpeg? > > Thanks, > Kind Regards, > Jay > > -- > View this message in context: http://imagej.1557.n6.nabble.com/Using-ImageJfor-registration-tp4998999p4999003.html > Sent from the ImageJ mailing list archive at Nabble.com. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Jaykris
On Tuesday 12 Jun 2012 12:34:42 you wrote:
> I thought about that. But there is a problem with the tif files generated by > bUnwarpJ. The tiff image files are blank when opened with any photo viewing > software like mspaint. When opened with picasa it says invalid image file. > But when opened with ImageJ I can see the proper image. It is because of > this I am having a problem comparing tiff images generated by bUnwarpJ with > other softwares. The other software you are using is probably not recognising the many flavours of tiff there are. > But if I save the generated tif file as jpg and the compare images using > other softwares the results are fine. These jpg files can also be seen > properly with mspaint and other applications. No, the results will never be fine. You should never use lossy jpegs in imaging: http://fiji.sc/wiki/index.php/IP_Principles If you need to export because of other software, use PNG if TIFF is not working for you. Cheers G. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Jaykris
Hi Jay,
I think the problem you have with the tiffs generated by bUnwarpJ is that they are multi-layered tiff stacks. Viewing them in ImageJ you should see that they each have 3 slices/layers: 1) the registered image, 2) the target image and 3) the black/white warp image - look for the horizontal scroll bar at the bottom of the image window. The other software probably expect to see a single-layered tiff rather than multi-layered. If I were writing a macro, I would get around this by calling run("bUnwarpJ", ...) to save a text file describing the transformation (I'm having some issues with this - see my other thread), followed by call("bunwarpj.bUnwarpJ_.elasticTransformImageMacro", ...) to apply that transformation to the source image. This results in a single-layered tiff containing only the registered image that should work fine with other software. It might be possible to do this via the command line. As I say I'm not familiar with the command line as I mostly do things using macros. It's possible someone else could suggest an simpler solution. Cheers, Tim |
In reply to this post by Jaykris
Don't blame any, blame software like MS Paint. You have to use Multi
Page TIFF capable software. Image Magic will do the job: convert mulitple.tif single%d.tif Best regards, K. Jaykris wrote: > .. But there is a problem with the tif files generated by > bUnwarpJ. The tiff image files are blank when opened with any photo viewing > software like mspaint. When opened with picasa it says invalid image file. > But when opened with ImageJ I can see the proper image. It is because of > this I am having a problem comparing tiff images generated by bUnwarpJ with > other softwares. > .. > > Is there any command line which can be used to do a save as from tiff to > jpeg? >.. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |