5.00.x
A char2num function that works for ASCII codes 0-->255.
Posted August 13th, 2008 by andyfaffThe inbuilt char2num function only works properly for ASCII codeset characters lying in between 0 and 127. However a lot of internet based applications, such as telnet, use characters above 127 regularly. These don't print properly in IGOR. This snippet performs the char2num function for characters that lie in between 0 and 255.
i.e. one gets around the problem:
print char2num(num2char(56)) 56 print char2num(num2char(249)) -7 print num2char(249) ÿ
Function extendedASCIIchar2num(chars) string chars make/o/t/n=(strlen(chars),2) W_chartranslation
Add Graphs To Notebook
Posted July 25th, 2008 by hrodstein// Adds graphs from list to notebook. // Example: // String graphList = "Graph0;Graph1;Graph2;" // AddGraphsToNotebook("MyNotebook", graphList, 2, 0, 50) Function AddGraphsToNotebook(nb, graphList, desiredNumGraphsInParagraph, graphicsMode, scaling) String nb // Name of notebook, e.g., "MyNotebook" String graphList // e.g., "Graph0;Graph1;" or WinList("*", ";", "") for all graphs Variable desiredNumGraphsInParagraph // e.g., 2 Variable graphicsMode // e.g., 0; See documentation for Notebook picture= command.
Save All Graphs As Graphics Files
Posted July 22nd, 2008 by hrodstein// SaveAllGraphsAsGraphicsFiles(pathName, extension, visibleOnly, format, bitmapRes) // NOTE: This overwrites existing files with the same name. // Example: // SaveAllGraphsAsGraphicsFiles("home", ".png", 1, -5, 288) Function SaveAllGraphsAsGraphicsFiles(pathName, extension, visibleOnly, format, bitmapRes) String pathName // Name of Igor symbolic path pointing to folder where graphics should be saved. String extension // Extension for file name, e.g., ".tif", ".pdf", ".png" . . .
Basic Rebinning
Posted July 16th, 2008 by andyfaffA beginners attempt at writing a histogram rebinning function, using linear interpolation.
#pragma rtGlobals=1 // Use modern global access method. Function Pla_intRebin(x_init, y_init,s_init, x_rebin) Wave x_init, y_init, s_init,x_rebin //Rebins histogrammed data into boundaries set by x_rebin. //makes the waves W_rebin and W_RebinSD. //it uses linear interpolation to work out the proportions of which original cells should be placed //in the new bin boundaries. // Precision will normally be lost. // It does not make sense to rebin to smaller bin boundaries.
Multiple file loader front end IGOR.5.00.x-1.2
Posted April 21st, 2008 by jtigorSize: 19.13 KB
md5_file hash: 41e92cf58c21ee5acbd71a27b7bc14e9
First released: April 21, 2008 - 14:31
Removed file loading specific code and generalized output so that a string list of selected files is compiled and stored in the panel specific data folder.
This should prove easier for the Igor programmer to incorporate into their own code.
Multiple file loader front end IGOR.5.00.x-1.1
Posted April 18th, 2008 by jtigorSize: 25.09 KB
md5_file hash: 2fb948795c1c94b71f4714fc6bdacea2
First released: April 18, 2008 - 14:27
Last updated: April 18, 2008 - 14:27
See main description. This is the first version.
Sorting 2D (text) waves, by using one column as a key
Posted April 10th, 2008 by andyfaffThis snippet sorts a multicolumn 2D text wave, by using one of the columns as a key (the normal sort operation only sorts 1D waves). The default is alpha numeric sorting, but that's easily fixed by changing the sort options. Also, would not be difficult to modify for a multidimensional numeric sort, just remove all the /t flags.
Function MDtextsort(w,keycol) Wave/t w variable keycol variable ii make/t/o/n=(dimsize(w,0)) key make/o/n=(dimsize(w,0)) valindex key[] = w[p][keycol] valindex=p sort/a key,key,valindex duplicate/o/t w, M_newtoInsert
calculate the centre of mass of an image
Posted April 7th, 2008 by andyfaffThis function calculates the centre of mass of an image. Needs to be supplied with image wave, and abscissa and ordinate values.
Function/c centreofMass2D(w,xx,yy) wave w,xx,yy //w is a 2D image wave. //xx and yy are abscissa and ordinates of image wave //xx and yy should be 1 point larger than w, as we are considering an image wave //return C-O-M via a complex value variable ii,jj,totalmass=0,sumrmx=0,sumrmy=0 for(ii=0;ii<dimsize(w,0);ii+=1) for(jj=0;jj<dimsize(w,1);jj+=1) totalmass+=w[ii][jj] sumrmx += w[ii][jj]*(xx[ii]+xx[ii+1])/2
base64 IGOR.5.00.x-1.0.x-dev
Posted March 30th, 2008 by andyfaffDownload: base64-IGOR.5.00.x-1.0.x-dev.zip
Size: 632.17 KB
md5_file hash: 301471622e8cf7698981cad318535068
First released: March 30, 2008 - 16:35
Last updated: June 2, 2008 - 05:00
Encodes and Decodes strings into base64
Code for TIFF export
Posted March 18th, 2008 by jamieExporting a TIFF image with Igor Script Alone
This function exports a multiplane greyscale tiff from a 3D wave. Igor at one point didn't export multiplane TIFFs "out of the box'. Before that, it didn't import them, either, but I have lost my TIFF import procedure.
This function handles waves of different bit depths, signed or unsigned, and sets the tags appropriately so other apps will know how to open it, if they support it, that is. I have tested 8 and 16 bit signed and unsigned integer and 32 bit floating point import into ImageJ.
