Hi, I'm trying to write a macro able to open all the files in a directory,
split the channels of the images and analyze particles in this separated channels as well as the composite between some of them (they will be also binarized, etc...). I have just done small macros using the macro recorder, so I don't know how to do it, I'm trying to get the identity of every image in a directory and then I guess after the image calculator, I will have to identify the new windows just created so they are processed as well, and then do that recursively, but I feel a little bit lost... which would be the easiest way to proceed? by know I'll try to understand the macro posted by Carnë Draug.. Thanks, ramon |
In fact I don't know how to identify the new windows created as a result of
the image calculation... On 7 April 2011 16:04, Ramon Guirado <[hidden email]> wrote: > Hi, I'm trying to write a macro able to open all the files in a directory, > split the channels of the images and analyze particles in this separated > channels as well as the composite between some of them (they will be also > binarized, etc...). I have just done small macros using the macro recorder, > so I don't know how to do it, I'm trying to get the identity of every image > in a directory and then I guess after the image calculator, I will have to > identify the new windows just created so they are processed as well, and > then do that recursively, but I feel a little bit lost... which would be the > easiest way to proceed? by know I'll try to understand the macro posted > by Carnë Draug.. > > Thanks, > > > ramon > |
In reply to this post by Ramon Guirado
On 7 April 2011 15:04, Ramon Guirado <[hidden email]> wrote:
> Hi, I'm trying to write a macro able to open all the files in a directory, > split the channels of the images and analyze particles in this separated > channels as well as the composite between some of them (they will be also > binarized, etc...). I have just done small macros using the macro recorder, > so I don't know how to do it, I'm trying to get the identity of every image > in a directory and then I guess after the image calculator, I will have to > identify the new windows just created so they are processed as well, and > then do that recursively, but I feel a little bit lost... which would be the > easiest way to proceed? by know I'll try to understand the macro posted > by Carnë Draug.. > > Thanks, > > > ramon I wrote a macro some time ago that does a similar thing. It opens all images, makes them composite, use one channel to find the nucleus (DAPI stained), and the two other channels to analyze particles inside the nucleus. I wrote it as macro and regret it, it's terribly confusing code. I find the ImageJ macro language terribly frustating. I should have bothered to learn Python to do it. Anyway, I pasted it into pastebin http://pastebin.com/R5dPsyqM You'll also need the other functions I posted before (I place them in macros/Library.txt so I don't have to bother copying into every macro). Carnë |
In reply to this post by Ramon Guirado
Hi Ramon:
These are the instructions we use to process all the files in a directory: ****** origen = getDirectory("Images to process"); destino = getDirectory("Results"); lista = getFileList(origen); setBatchMode(true); for (i=0; i<lista.length; i++) { showProgress(i+1, lista.length); open(origen+lista[i]); nombre = lista[i]; (MACRO FUNCTIONS/INSTRUCTIONS HERE) saveAs(".tiff", destino + nombre); close(); } ****** "Origen" and "destino" are just the names we have given to the variables (the path to the Directory and folder where you have your images and where you want to save your results). "nombre" is another variable to save the result image with the same name as the original image. To select a window use this instruction: selectWindow("NAME OF THE WINDOW"); An easy way to work with the 3 resultant images after splitting channels is to rename the original image: ******* rename("A"); run("Split Channels"); selectWindow("C2-A"); ******* I hope you find this information useful. Kind regards, Veronica On Thu, 7 Apr 2011 16:14:38 +0200, Ramon Guirado <[hidden email]> wrote: > In fact I don't know how to identify the new windows created as a > result of > the image calculation... > > On 7 April 2011 16:04, Ramon Guirado <[hidden email]> wrote: > >> Hi, I'm trying to write a macro able to open all the files in a >> directory, >> split the channels of the images and analyze particles in this >> separated >> channels as well as the composite between some of them (they will be >> also >> binarized, etc...). I have just done small macros using the macro >> recorder, >> so I don't know how to do it, I'm trying to get the identity of >> every image >> in a directory and then I guess after the image calculator, I will >> have to >> identify the new windows just created so they are processed as well, >> and >> then do that recursively, but I feel a little bit lost... which >> would be the >> easiest way to proceed? by know I'll try to understand the macro >> posted >> by Carnë Draug.. >> >> Thanks, >> >> >> ramon >> |
Thank you very much, the problem is the naming of the images, I want to
separate their channels and then tell the program which images I need to combine, and then I would need the name of the new image to tell the program to analyze particles... Anyway I liker the way of process all files in a directory :) On 7 April 2011 16:41, vlabrador <[hidden email]> wrote: > Hi Ramon: > > These are the instructions we use to process all the files in a directory: > > ****** > origen = getDirectory("Images to process"); > destino = getDirectory("Results"); > lista = getFileList(origen); > setBatchMode(true); > for (i=0; i<lista.length; i++) { > showProgress(i+1, lista.length); > open(origen+lista[i]); > nombre = lista[i]; > (MACRO FUNCTIONS/INSTRUCTIONS HERE) > saveAs(".tiff", destino + nombre); > close(); > } > ****** > > "Origen" and "destino" are just the names we have given to the variables > (the path to the Directory and folder where you have your images and where > you want to save your results). > > "nombre" is another variable to save the result image with the same name as > the original image. > > To select a window use this instruction: selectWindow("NAME OF THE > WINDOW"); > > An easy way to work with the 3 resultant images after splitting channels is > to rename the original image: > > ******* > rename("A"); > run("Split Channels"); > selectWindow("C2-A"); > ******* > > > I hope you find this information useful. > > Kind regards, > > Veronica > > > > On Thu, 7 Apr 2011 16:14:38 +0200, Ramon Guirado <[hidden email]> > wrote: > >> In fact I don't know how to identify the new windows created as a result >> of >> the image calculation... >> >> On 7 April 2011 16:04, Ramon Guirado <[hidden email]> wrote: >> >> Hi, I'm trying to write a macro able to open all the files in a >>> directory, >>> split the channels of the images and analyze particles in this separated >>> channels as well as the composite between some of them (they will be also >>> binarized, etc...). I have just done small macros using the macro >>> recorder, >>> so I don't know how to do it, I'm trying to get the identity of every >>> image >>> in a directory and then I guess after the image calculator, I will have >>> to >>> identify the new windows just created so they are processed as well, and >>> then do that recursively, but I feel a little bit lost... which would be >>> the >>> easiest way to proceed? by know I'll try to understand the macro posted >>> by Carnë Draug.. >>> >>> Thanks, >>> >>> >>> ramon >>> >>> |
In reply to this post by Carnë Draug
Thanks for this macro, I think many people share the hate for imageJ macro
language, indeed would be better to learn python instead. Anyway I think I can find all the commands I need in your macro, just it will require time to decipher what is what I need. Thanks!! ramon 2011/4/7 Carnë Draug <[hidden email]> > On 7 April 2011 15:04, Ramon Guirado <[hidden email]> wrote: > > Hi, I'm trying to write a macro able to open all the files in a > directory, > > split the channels of the images and analyze particles in this separated > > channels as well as the composite between some of them (they will be also > > binarized, etc...). I have just done small macros using the macro > recorder, > > so I don't know how to do it, I'm trying to get the identity of every > image > > in a directory and then I guess after the image calculator, I will have > to > > identify the new windows just created so they are processed as well, and > > then do that recursively, but I feel a little bit lost... which would be > the > > easiest way to proceed? by know I'll try to understand the macro posted > > by Carnë Draug.. > > > > Thanks, > > > > > > ramon > > I wrote a macro some time ago that does a similar thing. It opens all > images, makes them composite, use one channel to find the nucleus > (DAPI stained), and the two other channels to analyze particles inside > the nucleus. I wrote it as macro and regret it, it's terribly > confusing code. I find the ImageJ macro language terribly frustating. > I should have bothered to learn Python to do it. Anyway, I pasted it > into pastebin > > http://pastebin.com/R5dPsyqM > > You'll also need the other functions I posted before (I place them in > macros/Library.txt so I don't have to bother copying into every > macro). > > Carnë > |
I'm sorry but I think the word "hate" is a bit strong. And for many, many people the macro language is perfectly acceptable. The ability to record a macro by saying "watch me" is a great asset. Besides, considering the price you paid for ImageJ makes any complaints such as this come off rather whiny.
Phil On Apr 7, 2011, at 10:54 AM, Ramon Guirado wrote: > Thanks for this macro, I think many people share the hate for imageJ macro > language, indeed would be better to learn python instead. > Anyway I think I can find all the commands I need in your macro, just it > will require time to decipher what is what I need. > Thanks!! > > ramon > > 2011/4/7 Carnë Draug <[hidden email]> > >> On 7 April 2011 15:04, Ramon Guirado <[hidden email]> wrote: >>> Hi, I'm trying to write a macro able to open all the files in a >> directory, >>> split the channels of the images and analyze particles in this separated >>> channels as well as the composite between some of them (they will be also >>> binarized, etc...). I have just done small macros using the macro >> recorder, >>> so I don't know how to do it, I'm trying to get the identity of every >> image >>> in a directory and then I guess after the image calculator, I will have >> to >>> identify the new windows just created so they are processed as well, and >>> then do that recursively, but I feel a little bit lost... which would be >> the >>> easiest way to proceed? by know I'll try to understand the macro posted >>> by Carnë Draug.. >>> >>> Thanks, >>> >>> >>> ramon >> >> I wrote a macro some time ago that does a similar thing. It opens all >> images, makes them composite, use one channel to find the nucleus >> (DAPI stained), and the two other channels to analyze particles inside >> the nucleus. I wrote it as macro and regret it, it's terribly >> confusing code. I find the ImageJ macro language terribly frustating. >> I should have bothered to learn Python to do it. Anyway, I pasted it >> into pastebin >> >> http://pastebin.com/R5dPsyqM >> >> You'll also need the other functions I posted before (I place them in >> macros/Library.txt so I don't have to bother copying into every >> macro). >> >> Carnë >> Philip R. Ershler Ph.D. University of Utah Cardiovascular Research and Training Institute 95 South 2000 East Salt Lake City, UT 84112-5000 phone: (801) 230-8771 alt ph: (801) 587-9528 fax: (801) 581-3128 e-mail: [hidden email] |
Indeed, I think many of us, use ImageJ for the principles behind, I'm sure
many of you are in the situation that your university is paying licenses for privative imaging software, but you still prefer to use open software, and indeed our commentaries here help to improve things, but anyway if someone has a problem or inconvenience is free to expose it. let's change "hate" for frustrating thanks again, ramon On 7 April 2011 19:07, Philip Ershler <[hidden email]> wrote: > I'm sorry but I think the word "hate" is a bit strong. And for many, many > people the macro language is perfectly acceptable. The ability to record a > macro by saying "watch me" is a great asset. Besides, considering the price > you paid for ImageJ makes any complaints such as this come off rather whiny. > > Phil > > On Apr 7, 2011, at 10:54 AM, Ramon Guirado wrote: > > > Thanks for this macro, I think many people share the hate for imageJ > macro > > language, indeed would be better to learn python instead. > > Anyway I think I can find all the commands I need in your macro, just it > > will require time to decipher what is what I need. > > Thanks!! > > > > ramon > > > > 2011/4/7 Carnë Draug <[hidden email]> > > > >> On 7 April 2011 15:04, Ramon Guirado <[hidden email]> wrote: > >>> Hi, I'm trying to write a macro able to open all the files in a > >> directory, > >>> split the channels of the images and analyze particles in this > separated > >>> channels as well as the composite between some of them (they will be > also > >>> binarized, etc...). I have just done small macros using the macro > >> recorder, > >>> so I don't know how to do it, I'm trying to get the identity of every > >> image > >>> in a directory and then I guess after the image calculator, I will have > >> to > >>> identify the new windows just created so they are processed as well, > and > >>> then do that recursively, but I feel a little bit lost... which would > be > >> the > >>> easiest way to proceed? by know I'll try to understand the macro posted > >>> by Carnë Draug.. > >>> > >>> Thanks, > >>> > >>> > >>> ramon > >> > >> I wrote a macro some time ago that does a similar thing. It opens all > >> images, makes them composite, use one channel to find the nucleus > >> (DAPI stained), and the two other channels to analyze particles inside > >> the nucleus. I wrote it as macro and regret it, it's terribly > >> confusing code. I find the ImageJ macro language terribly frustating. > >> I should have bothered to learn Python to do it. Anyway, I pasted it > >> into pastebin > >> > >> http://pastebin.com/R5dPsyqM > >> > >> You'll also need the other functions I posted before (I place them in > >> macros/Library.txt so I don't have to bother copying into every > >> macro). > >> > >> Carnë > >> > > Philip R. Ershler Ph.D. > University of Utah > Cardiovascular Research and Training Institute > 95 South 2000 East > Salt Lake City, UT 84112-5000 > > phone: (801) 230-8771 > alt ph: (801) 587-9528 > fax: (801) 581-3128 > e-mail: [hidden email] > |
I can't use python; it's extremely frustrating. Oh, wait, I haven't really tried to learn it. Regardless, the problem isn't my deficiency; it's python's, right? Point made?
-Michael -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Ramon Sent: Thursday, April 07, 2011 1:46 PM To: [hidden email] Subject: Re: split channels and all files in a directory Indeed, I think many of us, use ImageJ for the principles behind, I'm sure many of you are in the situation that your university is paying licenses for privative imaging software, but you still prefer to use open software, and indeed our commentaries here help to improve things, but anyway if someone has a problem or inconvenience is free to expose it. let's change "hate" for frustrating thanks again, ramon ------------------------------------------------------------ This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email. ================================= |
Several people on the list have now responded very caustically to one
user's criticism of the ImageJ language. It is unpleasant to receive such messages in one's letterbox, especially since they contain zero useful information. If these comments excite such controversy, why not offer arguments as to why one language might be more appropriate than another? This is not a religious issue, after all... or is it for some of you? ;) Personally, I am dying to know in which cases Java or Python might be more suitable and why. - Elizabeth Cammer, Michael a écrit : > I can't use python; it's extremely frustrating. Oh, wait, I haven't really tried to learn it. Regardless, the problem isn't my deficiency; it's python's, right? Point made? > -Michael > > -----Original Message----- > From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Ramon > Sent: Thursday, April 07, 2011 1:46 PM > To: [hidden email] > Subject: Re: split channels and all files in a directory > > Indeed, I think many of us, use ImageJ for the principles behind, I'm sure > many of you are in the situation that your university is paying licenses for > privative imaging software, but you still prefer to use open software, and > indeed our commentaries here help to improve things, but anyway if someone > has a problem or inconvenience is free to expose it. > let's change "hate" for frustrating > thanks again, > > ramon > > > ------------------------------------------------------------ > This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email. > ================================= > -- Elizabeth CROWELL ---------------------------------------------------------------------- Membrane Traffic and Cell Division Research Group Institut Pasteur 28 rue du Dr Roux 75015 PARIS, France Tel : 01.44.38.94.07 Fax : 01.45.68.89.54 ---------------------------------------------------------------------- |
In reply to this post by Ramon Guirado
I share your frustrations, although I still think imageJ is one of the best software packages out there for microscopic image analysis.
The problem that I discovered is simply that the Macro language isn't comprehensive enough and contains a plethora of small bugs or non-functioning code. Particularly, the roiManager should be one of the most valuable tools but seems to have some of the most problems. For example, the only way to select ROI's in the Macro language is through Javascript and a Macro script call which fails at running in batch mode. Another example is that ROI's with the same name and shape are indistinguishable to the roiManager (aka if you delete one it will delete the other). Finally, juggling ROI's in one roiManager can become inefficient in certain cases. Running a couple instances of roiManagers would probably be a better idea. Anyway, if you are frustrated with the Macro language, I suggest you develop in pure Java. I am thinking about redoing parts of the project that I am working on as a plugin instead of a large macro program. You can even work on the plugins using Eclipse instead of the imageJ editor. As for Elizabeth's question, I would say that the majority of people in academia build large projects using Java because Java is portable (aka can run on all machines easily) and rids the user from worrying about pointers/clean-up. C/C++ is usually used for professional projects because of the speed and because of how much control it offers (C has many low level commands that even allow bit manipulation). There are Linux users who swear by Python though. I don't know very much Python, but, from what I do know, Python is a good language once you've mastered the language. One of the main benefits of Python is that the language is succinct. |
In reply to this post by Crowell Elizabeth
Hi,
On Thu, 7 Apr 2011, Crowell Elizabeth wrote: > Several people on the list have now responded very caustically to one > user's criticism of the ImageJ language. It is unpleasant to receive > such messages in one's letterbox, especially since they contain zero > useful information. If these comments excite such controversy, why not > offer arguments as to why one language might be more appropriate than > another? This is not a religious issue, after all... or is it for some > of you? ;) The ImageJ macro language is really useful for many applications. Do not let yourself get confused on that fact. However... > Personally, I am dying to know in which cases Java or Python might be > more suitable and why. ... using Python (in the form of Jython) allows you to write programs in a fully object-oriented manner. It also allows you to access the complete ImageJ API, which is both more complete in parts as well as more limited in parts than the macro language. For example, if you need to add a button to a dialog, you cannot do that with the macro language (since you cannot provide callback functions to be called upon click of the button). This is very easy to do in Python. Unfortunately, there are a few (not very many, in fact) functions in the macro language which are not exposed via the Java API. One notable example is the duplication of a complete hyperstack, which is non-straight-forward in Java/Python. Ciao, Johannes |
Free forum by Nabble | Edit this page |