Hi all,
I'm getting a really strange behaviour on Fiji. The following Macro outputs two different Threshold values for me. The idea is to ask the user for the threshold method on the currently open image (a fluorescent image stack) Then I can store this somewhere and find the threshold ON THE SAME IMAGE by calling setAutoThreshold(""); However, when the user selects a threshold method, and clicks OK if I run setAutoThreshold with the method he provided (With the "dark stack" arguments as well) Then the thesholds are different! Anyone know what's going on? Second comment: Using "Stack Histogram" on multichannel images yields wrong results as the histogram of all channels is used for the threshold calculation! Best Small macro: run("Confocal Series (2.2MB)"); run("Split Channels"); selectWindow("C1-confocal-series.tif"); run("Threshold..."); waitForUser("Select a thresholding method (Use Dark Background and Stack Histogram\nBut don't apply it"); //Getting the thresholds from the user getThreshold(thrL, no_use); // Get the Thresholding method thrM = getInfo("threshold.method"); // Now set it again selectWindow("C1-confocal-series.tif"); setAutoThreshold(thrM+" dark stack"); getThreshold(newLow, no_use); //Print it print("Call: setAutoThreshold("+thrM+" dark stack);"); print(" Thr from first getThreshold call: "+thrL); print("Thr from second getThreshold call: "+newLow); Olivier Burri Engineer, Development in Image Processing BioImaging and Optics platform (PTBIOP) Tel: [+4121 69] 39629 |
On Tuesday 24 Apr 2012 19:07:40 you wrote:
> The following Macro outputs two different Threshold values for me. > > The idea is to ask the user for the threshold method on the currently open > image (a fluorescent image stack) > > Then I can store this somewhere and find the threshold ON THE SAME IMAGE by > calling setAutoThreshold(""); Can't replicate in ImageJ or Fiji: Call: setAutoThreshold(Li dark stack); Thr from first getThreshold call: 17 Thr from second getThreshold call: 17 Call: setAutoThreshold(Otsu dark stack); Thr from first getThreshold call: 50 Thr from second getThreshold call: 50 Cheers Gabriel |
Thanks for the info..
Could you try it with setBatchMode(true) and see if the behavior changes? Best Oli ________________________________________ From: ImageJ Interest Group [[hidden email]] on behalf of Gabriel Landini [[hidden email]] Sent: Tuesday, April 24, 2012 9:05 PM To: [hidden email] Subject: Re: Problems with SetAutoThreshold On Tuesday 24 Apr 2012 19:07:40 you wrote: > The following Macro outputs two different Threshold values for me. > > The idea is to ask the user for the threshold method on the currently open > image (a fluorescent image stack) > > Then I can store this somewhere and find the threshold ON THE SAME IMAGE by > calling setAutoThreshold(""); Can't replicate in ImageJ or Fiji: Call: setAutoThreshold(Li dark stack); Thr from first getThreshold call: 17 Thr from second getThreshold call: 17 Call: setAutoThreshold(Otsu dark stack); Thr from first getThreshold call: 50 Thr from second getThreshold call: 50 Cheers Gabriel |
On Tuesday 24 Apr 2012 21:30:18 you wrote:
> Could you try it with setBatchMode(true) and see if the behavior changes? I think you shouldn't call batch mode at the start, to then interrupt it with the waitForUser call. I think you might lose the focus of the image you are working on. If you call batch mode after the waitForUser, then it seems to work: -------------------------------------- run("Confocal Series (2.2MB)"); run("Split Channels"); selectWindow("C1-confocal-series.tif"); run("Threshold..."); waitForUser("Select a thresholding method (Use Dark Background and Stack Histogram\nBut don't apply it"); setBatchMode(true); //////////////////////////// <-------Here //Getting the thresholds from the user getThreshold(thrL, no_use); // Get the Thresholding method thrM = getInfo("threshold.method"); // Now set it again selectWindow("C1-confocal-series.tif"); setAutoThreshold(thrM+" dark stack"); getThreshold(newLow, no_use); //Print it print("Call: setAutoThreshold("+thrM+" dark stack);"); print(" Thr from first getThreshold call: "+thrL); print("Thr from second getThreshold call: "+newLow); -------------------------------------- |
In reply to this post by Olivier Burri
On Apr 24, 2012, at 2:07 PM, Burri Olivier wrote:
> Hi all, > > I'm getting a really strange behaviour on Fiji. > > The following Macro outputs two different Threshold values for me. > > The idea is to ask the user for the threshold method on the currently open image (a fluorescent image stack) > > Then I can store this somewhere and find the threshold ON THE SAME IMAGE by calling > setAutoThreshold(""); > > However, when the user selects a threshold method, and clicks OK > if I run setAutoThreshold with the method he provided (With the "dark stack" arguments as well) > > Then the thesholds are different! > > Anyone know what's going on? > > Second comment: > Using "Stack Histogram" on multichannel images yields wrong results as the histogram of all channels is used for the threshold calculation! -wayne > Best > > Small macro: > > run("Confocal Series (2.2MB)"); > run("Split Channels"); > selectWindow("C1-confocal-series.tif"); > run("Threshold..."); > waitForUser("Select a thresholding method (Use Dark Background and Stack Histogram\nBut don't apply it"); > > //Getting the thresholds from the user > getThreshold(thrL, no_use); > > // Get the Thresholding method > thrM = getInfo("threshold.method"); > > // Now set it again > > > selectWindow("C1-confocal-series.tif"); > setAutoThreshold(thrM+" dark stack"); > getThreshold(newLow, no_use); > > //Print it > print("Call: setAutoThreshold("+thrM+" dark stack);"); > print(" Thr from first getThreshold call: "+thrL); > print("Thr from second getThreshold call: "+newLow); > > > > > Olivier Burri > Engineer, Development in Image Processing > BioImaging and Optics platform (PTBIOP) > Tel: [+4121 69] 39629 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Dear Mr. Rasband, For any amendment on your booking you should contact directly with Viajes I= beria. Do not hesitate in contact us for any further information. Best regard <http://www.hotelbarcelonaprincess.com/> Maria Romeo Departamento de Reservas Hotel Barcelona Princess****sup Avda. Diagonal, 1 08019 Barcelona Telf. Directo 93 117 40 50 T. 0034 93 356 1000 F. 0034 93 356 1022 [hidden email]<mailto:[hidden email]> www.hotelbarcelonaprincess.com<http://www.hotelbarcelonaprincess.com/> www.princess-hotels.com<http://www.princess-hotels.com/> <http://www.facebook.com/HotelBarcelonaPrincess> <http://www.flick= r.com/photos/bcnprincess> <http://www.twitter.com/bcnprincess> <http://ww= w.youtube.com/user/BarcelonaPrincess> Codigos en GDS para el Hotel Barcelona Princess Sabre: SE-54496 | Apollo:SE-20526 | Worldspan: SE-6859 Amadeus:SE-BCN859 <http://www.dreamsprincess.net/barcelona/index.html> <http://www.= sima.es/> <http://www.ghotw.com/shotw/> Abans d=B4imprimir aquest correu, assegura=B4t que =E9s del tot necessari EL MEDI AMBIENT =C9S COSA DE TOTS !! Antes de imprimir este e-mail piense bien si es necesario hacerlo: contribu= ya a la preservaci=F3n del medio ambiente Before printing this e-mail thinks well if it is necessary to make it: cont= ribute to the preservation of the environment Please note that your email address, as well as the rest of the personal da= ta provided, shall be subject to automatic in our files, in order to manage= the address book of our company and, if they want tomeet their demands Con= sultation electronically. You may at any time exercise the right of access,= rectification, cancellation and opposition in the manner provided in the L= aw 15/1999 by giving written notice with a copy of your national identity c= ard at BARCELONA RESORT, SL. Avda Diagonal 1-3, Barcelona 08019, or through= this e-mail. The information contained in this email is CONFIDENTIAL is fo= r the exclusive use of the addressee above. If you get this message and you= are not the recipient mentioned, please notify us immediately and proceed = down this path to its elimination together with its annexes files without r= eading or saving. Barcelona Resort, S.L. NIF B61809307 R.M. Barcelona Tomo 31197 Folio 183 Ho= ja B190146 Inscrip.1=AA Wayne Rasband <[hidden email]> 19/04/2012 03:50 Para [hidden email] cc Asunto Fwd: ISBI 2012 Hotel Confirmation Dear Barcelona Princess, I have a room reserved at your hotel for 3 nights starting 29 April but I a= rrive in Barcelona on 28 April so I need to check in one day early. Can I r= eserve the extra night (28 April) directly or do I need to contact Viajes = Iberia Congresos? I attached the ISBI 2012 hotel confirmation I received fr= om Viajes Iberia Congresos. Best regards, Wayne Rasband ([hidden email]<mailto:[hidden email]>) 4214 McCain Ct Kensington, Maryland, 20895 USA Begin forwarded message: From: ISBI 2012 Hotel <[hidden email]<mailto:isbi2012@viajesiber= ia.com>> Date: February 21, 2012 1:48:17 PM EST To: <[hidden email]<mailto:[hidden email]>> Subject: ISBI 2012 Hotel Confirmation February 21 2012 Ref: 24 Wayne Rasband National Institutes Of Health 4214 McCain Ct KENSINGTON, MD 20895 UNITED STATES Confirmation Letter and= Receipt Dear Mr. Wayne Rasband, Thank you for booking accommodation for the International Symposium on Biom= edical Imaging (ISBI) in Barcelona, Spain. This email is your confirmation = letter and receipt, please keep a copy for your records. SUMMARY All rates are in Euros, include breakfast and 8% VAT tax. Reservation Hotel Check In Check Out Deposit Owing Barcelona Princess **** Avda. Diagonal, 1 08019 Barcelona SPAIN Tel: +34 93 117 40 52 Fax: Double Room Single Use (Paid) Apr 29 2012 ETA: Check in from 3pm May 2 2012 ETD: Check out by 12 midday 141.00 0.00 Daily Rate =80 141.00 Sharing with Special requests The amount charged for this transaction will be deducted from the hotel inv= oice when you check out from the hotel. If you have paid by credit card your purchase will appear as "Viajes Iberia= " on your statement. Please check that the above information is correct. Any changes or cancella= tions should be addressed to [hidden email]<mailto:isbi2012@viaj= esiberia.com> in writing. Cancellation Terms and Conditions 1- Before 2nd March 2012: In the event of cancellation the deposit will be = refunded. There will be no penalty for the reduction in the number of night= s. 2- Between 3rd March 2012 and 1st April 2012: In the event of cancellation = the deposit will be charged as a cancellation fee. There will be no penalty= for the reduction in the number of nights. 3- From 2nd April 2012: In the event of cancellation / reductions in the nu= mber of nights or no-shows, the entire booking period will be charged. We look forward to welcoming you to Barcelona! Kind regards, Viajes Iberia Congresos ISBI 2012 Technical Secretariat Pl. Europa 17-19 - Ed. Orizonia, 1st floor 08908 L'Hospitalet de Llobregat (Barcelona) Spain Tel: +34 93 510 10 05 - Fax: +34 93 510 10 09 [hidden email]<mailto:[hidden email]> |
Hello again,
After much struggling, I've noticed why there is a difference when I call my macro. Try running the previous code with "Limit To Threshold" selected in the "Set Measurements..." Menu. Basically what this means is that 1. You launch the threshold dialog and wait for the user to select a threshold 2. The user selects an auto threshold 3. You re-run setAutoThreshold in the macro -> It looks for a threshold within the already given threshold! So I'm not sure what to think of it, or whether this is a correct assumption or some other bug. My guess is that the Thresholding methods call for something from the Measure class that is measuring things inside the threshold. But a call to resetThreshold() before running the setAutoThreshold fixes it. Thanks all for your time and hope this helps other people with the same problem. Also: > Second comment: > Using "Stack Histogram" on multichannel images yields wrong results as the histogram of all channels is used for the threshold calculation! This bug is fixed in the ImageJ 1.46n daily build. Image>Adjust>Threshold, when the "Stack histogram" option is enabled, now uses the histogram of the current channel instead of the histogram of all the channels. -wayne Thank you Wayne! Best Oli |
On Apr 25, 2012, at 3:15 AM, Burri Olivier wrote:
> Hello again, > > After much struggling, I've noticed why there is a difference when I call my macro. > > Try running the previous code with "Limit To Threshold" selected in the "Set Measurements..." Menu. > > Basically what this means is that > 1. You launch the threshold dialog and wait for the user to select a threshold > 2. The user selects an auto threshold > 3. You re-run setAutoThreshold in the macro > -> It looks for a threshold within the already given threshold! > So I'm not sure what to think of it, or whether this is a correct assumption or some other bug. > My guess is that the Thresholding methods call for something from the Measure class that is measuring things inside the threshold. > > But a call to > resetThreshold() > before running the setAutoThreshold fixes it. This bug (incorrect automatic stack threshold when "Limit to threshold" is enabled) is fixed in the ImageJ 1.46n daily build. -wayne > > Thanks all for your time and hope this helps other people with the same problem. > > Also: > >> Second comment: >> Using "Stack Histogram" on multichannel images yields wrong results as the histogram of all channels is used for the threshold calculation! > > This bug is fixed in the ImageJ 1.46n daily build. Image>Adjust>Threshold, when the "Stack histogram" option is enabled, now uses the histogram of the current channel instead of the histogram of all the channels. > > -wayne > > Thank you Wayne! > > Best > > Oli |
Free forum by Nabble | Edit this page |