HELP! how to load N images (loop) and fit, then plot fit results from all images in one curve

PLEASE HELP! how to load N images (loop) and fit, then plot fit results(e.g. center of a 2Dgaussian) from all images in one curve.
So that to see how the fit is changing with every image. For example a center coordianates of a gaussian fit move linearly in one direction and I would get a straight line.
Can anybody please advise me on how to start writnig this code I am new to IGOR?
I can fit but I don't know how to open files one by one by looping its name?
VL2008 wrote:
PLEASE HELP! how to load N images (loop) and fit, then plot fit results(e.g. center of a 2Dgaussian) from all images in one curve.
So that to see how the fit is changing with every image. For example a center coordianates of a gaussian fit move linearly in one direction and I would get a straight line.
Can anybody please advise me on how to start writnig this code I am new to IGOR?
I can fit but I don't know how to open files one by one by looping its name?


On Igor's command line, execute this command to see an example of code to do multiple fits in a loop:

DisplayHelpTopic "Batch Fitting"

To see an example of loading multiple files:

DisplayHelpTopic "Loading Waves Using Igor Procedures"

That material includes example code for loading all the files in a folder. You will need to combine the examples to do batch fitting of data loaded from files on disk.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
VL2008 wrote:
PLEASE HELP! how to load N images (loop) and fit, then plot fit results(e.g. center of a 2Dgaussian) from all images in one curve. ... Can anybody please advise me on how to start writnig this code I am new to IGOR? ...


Some general suggestions:

1) break the task into separate parts

Function LoadAnImage(imageFileonDisk)
   <do whatever is needed to load an image from disk>
   <return with the file loaded into a specific folder>
   return FullPathtoImageFile
end

Function FitAnImage(FullPathtoImageFile,i)
   <do whatever is needed to fit the image>
   <return with the x,y coordinates stored in a set of waves>
    xwave[i] = ...
    ywave[i] = ...
    return 0
end

Function FitGaussianCenterCoordinates(xwave,ywave)
   <do whatever is needed to fit ywave vs xwave>
   <return with the fit coefficients>
   m = ...
   b = ...
   return 0
end


You can find hints for each part in the tutorials, manual, and here.

2) test each function on data where you know the results before hand

3) create and test a function to do the first two parts

Function DoOne(whichone)
   <set the name of the image to load>
   myImagePath = LoadAnImage(myImageFileonDisk)
   FitAnImage(myImagePath,whichone)
   return 0
end


4) create and test a loop function

Function DoThemAll()
   <initialize stuff>
   for(i=0;i<numberoffiles;i+=1)
       DoOne(i)
   endfor
   return 0
end


5) add the final analysis

Function DoThemAll()
   ...
   FitGaussianCenterCoordinates(xwave,ywave)
   return 0
end


HTH
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH