Login  Register

Using getTitle()

Posted by mnqslbs2 on Mar 09, 2009; 1:29pm
URL: http://imagej.273.s1.nabble.com/Using-getTitle-tp3687039.html

Hello all,

I'm very new to programming macro and plug-ins for image J.  
I'm trying speed up the process I do by using macros linked to shortcut keys on the keyboard, this I have managed.  
I have a problem with the macro I'm writing at the moment.
I have two stacks that I am merging to give a stack with one signal in green and the other in magenta to look for colocalisation.  
The stacks are called "Series003 Red" and "Series003 Green" however the 003 sometimes changes to 004, or 005 etc.  Everything else remains the same.  

This is what I have so far:--

name = getTitle()

run("Merge Channels...", "red=[name Red] green=[name Green] blue=[name Red] gray=*None*");

saveAs("Tiff");

--So I have used getTitle to specify name = Series003 Red
My problem is how to tell the macro to drop the "Red" portion and just give me "Series003", therefore returning the correct name if the series number is not 003 but 004 etc.  I need to drop the "Red" part to use the returned name for the green channel.  

I hope this makes more sense to you than it does to me.  

I look forward to seeing if this can been done (it must be possible)..

Cheers