ImageJ saving "anisotropic diffusion 2D" plugin output in a macro - plugins

I have been trying to create a macro in ImageJ (Fiji) that would allow me to batch process a stack of images in a folder using the "anisotropic diffusion 2D" plug-in and automatically save outputs of the plug-in into a dedicated folder.
However, while I am managing to run the plug-in from the macro, I am not able to save the new processed image that it generates, it only saves the unprocessed starting image. I am wondering whether I have to somehow select the newly created image before attempting to save the image. Any help with this would be much appreciated.

The following macro I recorded using ImageJ's macro recorder:
run("Blobs (25K)");
run("Anisotropic Diffusion 2D", "number=20 smoothings=1 keep=20 a1=0.50 a2=0.90 dt=20 edge=5");
saveAs("Tiff", "C:\\temp\\blobs-iter20.tif");
and it works as expected, opening the Blobs sample image and saving the result image generated by the Anisotropic Diffusion 2D plugin in C:\temp\blobs-iter20.tif.

Related

how to save figure of gui plot which will run on a computer that does not have matlab

I have made a Gui program that I compile to EXE application which lots csv file into graph data. I buit a save button but I do not know how save figure with different name each time cause (savefig anduisave both uses matlab program). I am posting my code below if anyoff you guys figure out how to save gui figue into image or anything that does require matlab to open. Last function is the callback function for save button.
function ma_Callback(hObject, eventdata, handles)
% i tried uisave but not possible to run computer without matlab cause mcr
% does not run uisave
% i tried copyopbj but since i did not put a name on my figure it did not
% work
%savefig
If you are trying to save a kind of image from your figure, then the best option which supports many aspects, is using print function.
I have already done this in a compiled app and it works perfect. Using print function you can set different file type(vector formats like *.svg are also supported), resolution(dpi), and so many others.
Although you can use print function directly on the figure, but I found that the best way (More Customization like removing or adding some objects and changing many options) is to follow this steps:
Create another figure with Visible='on' but a position that is out of screen with the same width and height of Main Figure.
normalized position = [-1, -1, ?, ?]. (Create this figure in start up and don't destroy it until your app exits, let call it Print Figure).
Copy your figure content (or the parts you are interested in) using copyobj to that figure (you may need to set Parent property of some key objects like panels to this new figure). They would look exactly as they look in the main figure, because they have the same properties. you can add or remove some objects in this step.
Change aspect ratio of "Print Figure" for a better output.
Print this figure with all options (file format, dpi, ...) you need. in my own GUI i allowed the user to change this settings with an input dialog.
In my app i used functions like winopen to show the output, and output directory to the user, when the print task was done. Print process takes some time, specially if dpi is huge, so it is also a good idea to inactivate buttons and show wait cursor.
Update:
a simple usage would be:
print(MainFigure, 'myFileName', '-dpng', '-r300')

How to export view to a vector image format in Netlogo

I would like to export the exact view of agents layout (including their shapes and colors) into a vector image file format such as EPS, PDF, SVG,...
Is there any way to do that without vectorizing the generated PNG files with another application?
EDIT 1:
I tried to write an extension as Seth recommended, but the generated image is as follows:
Generated Image of the extension
EDIT 2:
The problem was with the vector library I was using. Changing the library, the extension works like a charm!
A new extension is built to export the view of model to a vector image file. The supported formats are EPS, PDF, and SVG.
You can find the source and the built files here:
https://github.com/aesmaeili/vectorview
Great question! Sadly no, this is not supported in stock NetLogo. It should be; I wish it were!
SVG would be an excellent choice of output format.
Someone with some knowledge of Java or Scala coding could write a NetLogo extension that does this, by recording the Java2D calls that the NetLogo renderer makes, using a library such as https://xmlgraphics.apache.org/batik/using/svg-generator.html.

Image Sequences to video conversion in matlab

I have to convert image sequences to a video using 'matlab R2010a' version. What function should I use to load images to a video? In 'Matlab R2013a' version, 'writeVideo' is used. What is the related function of 'writeVideo' in 'R2010a' version?
If your images are created by some Matlab code, then you can always save them as image files (check out the print function), and use some utility (like VirtualDub) to convert the image files to video.
If it is enough to play the image sequence without saving it, then use the movie function.

Matlab imshow() not showing the image properly

I have a simple code to show an image in Matlab. I use imread() to read it and imshow() to show it. the code it below, and the result in not shown properly. hope someone can help me.
img = imread('/home/samuelpedro/Desktop/API - Projecto/coimbra_aerea.jpg');
figure, imshow(img);
the resulting image is below.
also, if i choose to save it to file as a new jpg it is saved correctly.
UPDATE 1:
weirdly if i choose to show the axes in the preferences>image processing, it is corrected
Locking at your screen-shot, the x- and y-ticks are missing. They should appear in a standard-configuration of Matlab. Maybe something is just messed up in the Matlab-configuration. Try to do this with a clean new ~/.matlab folder (rename the old one before).
Alternatively ... again judging by your screen-shot, this looks like Ubuntu/Unity in the background. Unity needs acceleration (OpenGL), which can be randomly buggy for some Linux graphics drivers. You may want to try to launch matlab in a "clean" X-server (maybe the twm environment) to rule this out.
Save the image as an (uncompressed) bitmap (bmp) and read it with imread. If the jpg is messed up by the imread-routine, this should rule this out.
Last but not least, broken copy of your jpg on your disk, some flipped bits. Run md5sums on your file's copies.

image save in matlab

I have an image and after drawing some features(ellipses and text) on it I want to save it as JPEG.
h= figure(1);
imagesc(im_name);
colormap('gray');
hold on
for i=1:no_of_points;
//draw features and write some text
end
hold off
imsave (h);
I am getting a figure with features drawn on it but when I save it, it is an image (which is my orignal image 'im_name') without new features on it.
I tried also
.
.
.
imsave (h);
hold off
Thanx in advance for your help.
Maybe you should try the function saveas
saveas
Save figure or Simulink block diagram using specified format
Alternatives
Use File > Save As on the figure window menu to access the Save As
dialog, in which you can select a graphics format. For details, see
Exporting in a Specific Graphics Format in the MATLAB Graphics
documentation. Sizes of files written to image formats by this GUI and
by saveas can differ due to disparate resolution settings. Syntax
saveas(h,'filename.ext') saveas(h,'filename','format')
Description
saveas(h,'filename.ext') saves the figure or Simulink block diagram
with the handle h to the file filename.ext. The format of the file is
determined by the extension, ext. Allowable values for ext are listed
in this table.
You can pass the handle of any Handle Graphics object to saveas, which
then saves the parent figure to the object you specified should h not
be a figure handle. This means that saveas cannot save a subplot
without also saving all subplots in its parent figure.
When using the saveas function the resolution isn't as good as when manually saving the figure with File-->Save As..., It's more recommended to use hgexport instead, as follows:
hgexport(gcf, 'figure1.jpg', hgexport('factorystyle'), 'Format', 'jpeg');
This will do exactly as manually saving the figure.
Source.