0

I am trying to run the Thunderstorm plugin in ImageJ on all files in a folder. Once I perform the localizations and get results, I want to export the results in a csv file such that the first part of the csv file contains the image name. Here is the script I have:

    dir=getDirectory("Choose a Directory");
    datapaths=getFileList(dir);
      for(i = 0; i < datapaths.length; i++) { 
       if (endsWith(datapaths[i], ".tif")) {
        open(datapaths[i]);
        run("Run analysis", "filter=[Wavelet filter (B-Spline)] scale=2.0 order=3 detector=[Local maximum] connectivity=4-neighbourhood threshold=std(Wave.F1) estimator=[PSF: Gaussian] sigma=0.8 fitradius=2 method=[Maximum likelihood] full_image_fitting=false mfaenabled=true keep_same_intensity=false nmax=2 fixed_intensity=true expected_intensity=500:2500 pvalue=1.0E-6 renderer=[No Renderer] magnification=5.0 avg=0 colorizez=false threed=false repaint=50");
        run("Export results", "filepath=["+datapaths[i]+"data.csv] fileformat=[CSV (comma separated)] sigma=true intensity=true offset=true saveprotocol=true x=true y=true bkgstd=true id=false uncertainty=true frame=true");
    }
   }

I am certain that I am making some mistake in the "Export results", "filepath=["+datapaths[i]+"data.csv] part. Even after going through the 8 posts on the topic, I am unable to fix this mistake. Please advise.

Thanks,

saurCMat
  • 9
  • 3

1 Answers1

0

Here is the solution.

    dir=getDirectory("Choose a Directory");
    datapaths=getFileList(dir);
    for(i = 0; i < datapaths.length; i++) { 
       if (endsWith(datapaths[i], ".tif")) {
          dpaths=dir + datapaths[i];
          open(datapaths[i]);
          run("Run analysis", "filter=[Wavelet filter (B-Spline)] scale=2.0 order=3 detector=[Local maximum] connectivity=4-neighbourhood threshold=std(Wave.F1) estimator=[PSF: Gaussian] sigma=0.8 fitradius=2 method=[Maximum likelihood] full_image_fitting=false mfaenabled=true keep_same_intensity=false nmax=2 fixed_intensity=true expected_intensity=500:2500 pvalue=1.0E-6 renderer=[No Renderer] magnification=5.0 avg=0 colorizez=false threed=false repaint=50");
          run("Export results", "filepath=["+dpaths+"data.xls] fileformat=[XLS (tab separated)] sigma=true intensity=true offset=true saveprotocol=true x=true y=true bkgstd=true id=false uncertainty=true frame=true");
          print(dir + dpaths);
          }
       }
saurCMat
  • 9
  • 3