opening file from macro

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

opening file from macro

Nilwik Rachel (BW)
Hello everyone,

I have a question that I know for sure is quite simple, but I can't really find the right topic in the mailing list archive... perhaps I don't know what exactly to look for. The main problem is that I really don't have a clue about programming (and the commands used) in general...

The thing is, I open an image, perform some modifications and save the changed image in the same folder. Then, I want to open the original, unchanged image again, without closing the changed one. When using the macro recorder, I can of course manually open and save images, but this gives a code specifically for the image I am opening at that time, and I want it to work for other images as well.

I can imagine that there is a list with commands somewhere that I can use for this type of thing, could anyone perhaps give me a link?

Thanks so much!
Rachel



What I have until now is the following:

// After opening a file, first, retrieve the name+directory of the current image, without extension, for later use.
name = getTitle();
dotIndex = indexOf(name, ".");
image_name = substring(name, 0, dotIndex);
dir = getDirectory("image")

//then, some adjustments like split channels - thresholding etc

//Now, I would like to save the thresholded image separately, in the same directory as the original one and then re-open the original image.
// Or, perform the Split Channels tool without closing the original one...





--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: opening file from macro

Kenton Arkill
Hi
http://rsbweb.nih.gov/ij/developer/macro/functions.html
The bits you want are under 'file' functions. But I suggest 'getFileList(directory)'
as a start, there are example macros on this. You can then reopen any time you like.
Kenton

Kenton Arkill
GB U23 Ladies'
Underwater Hockey Coach
GB Masters
Underwater Hockey Manager




On 28 Aug 2012, at 07:12, Nilwik Rachel (BW) wrote:

> Hello everyone,
>
> I have a question that I know for sure is quite simple, but I can't really find the right topic in the mailing list archive... perhaps I don't know what exactly to look for. The main problem is that I really don't have a clue about programming (and the commands used) in general...
>
> The thing is, I open an image, perform some modifications and save the changed image in the same folder. Then, I want to open the original, unchanged image again, without closing the changed one. When using the macro recorder, I can of course manually open and save images, but this gives a code specifically for the image I am opening at that time, and I want it to work for other images as well.
>
> I can imagine that there is a list with commands somewhere that I can use for this type of thing, could anyone perhaps give me a link?
>
> Thanks so much!
> Rachel
>
>
>
> What I have until now is the following:
>
> // After opening a file, first, retrieve the name+directory of the current image, without extension, for later use.
> name = getTitle();
> dotIndex = indexOf(name, ".");
> image_name = substring(name, 0, dotIndex);
> dir = getDirectory("image")
>
> //then, some adjustments like split channels - thresholding etc
>
> //Now, I would like to save the thresholded image separately, in the same directory as the original one and then re-open the original image.
> // Or, perform the Split Channels tool without closing the original one...
>
>
>
>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html