DrHanLim / EzColocalization

GNU General Public License v3.0
10 stars 2 forks source link

Maco doesn't work properly #3

Closed shenghuanjie closed 5 years ago

shenghuanjie commented 5 years ago

TOS is returning NaN, and MCC is returning values of 1 when a macro is used, while the other metrics are fine (even when using a threshold with them). I've figured out that the error is caused by the run function of the macro, so the attached macro which just runs EzColocalization on the example images has the problem.

run("EzColocalization ", "reporter_1_(ch.1)=HL6187_DAPI.tif reporter_2_(ch.2)=HL6187_GFP.tif cell_identification_input=HL6187_Phase.tif alignthold4=default tos metricthold1=ft allft-c1-1=15 allft-c2-1=15 allft-c3-1=10 mcc metricthold5=costes' allft-c1-5=10 allft-c2-5=10 allft-c3-5=10");
shenghuanjie commented 5 years ago

This is caused by the following lines in main/MacroHandler.java

for(int iMetric=0;iMetric<metricThold_radios.length;iMetric++){
            start=arg.indexOf("metricthold"+(iMetric+1)+"=");
            if(start==-1){
                metricThold_radios[iMetric] = DEFAULT_CHOICE;
            }else{
                start += (("metricTholds"+(iMetric+1)+"=").length());
                end=arg.indexOf(" ", start);
                if ((arg.charAt(start)+"").equals("[")){
                    start++;
                    end=arg.indexOf("]", start);
                }
                String thisThold = arg.substring(start, end);
                metricThold_radios[iMetric] = (int)parseDouble(thisThold);
            }
            if(metricThold_radios[iMetric]==BasicCalculator.THOLD_FT)
                iFTs+=allFT_spins.length;
        }

Here start += (("metricTholds"+(iMetric+1)+"=").length()); should read start += (("metricthold"+(iMetric+1)+"=").length());