Load n files, specifying first file
| Thomas.Dane | March 6, 2012 - 07:43 | ||
|---|---|---|---|
|
Hi all, I have written a procedure, which I will be implementing in a GUI, where n image files are loaded. The number of images (n) is already determined by the length of a pre-existing wave. The user selects the first file in the list from a dialogue, the script then loads all the waves. My approach was to select the first file, then generate a list of all the files in the folder using Function LoadAllimagesFromScan() String pathName = "" String fileName = "" Open/D/R/T="TIFF" /P=$pathName /M="Select first image in scan" refNum as fileName If ( strlen(S_fileName) == 0 ) return -1 endif pathName = ParseFilePath(1, S_fileName, ":", 1, 0) NewPath/O myPath pathName fileName = ParseFilePath(0, S_fileName, ":", 1, 0) String FilesInFolder = IndexedFile(myPath, -1, "TIFF") Variable firstFileIndex = WhichListItem(fileName, FilesInFolder) Wave wAlphaI = $(StringFromList(0,WaveList("*","","DIMS:1"))) // there is only one wave in this folder with Dim = 1 String filesToLoad = "" Variable fileIndex = firstFileIndex Do filesToLoad += IndexedFile(myPath, fileIndex, "TIFF")+";" if( strlen(fileName) == 0 ) break endif fileIndex += 1 While( fileIndex < firstFileIndex+(NumPnts(wAlphaI) ) String ImageLoadCMD sprintf ImageLoadCMD, "ImageLoad/P=%s/T=TIFF %s" , pathName, filesToLoad Execute ImageLoadCMD End Thanks, Tom |
|||

Joined: 2007-06-29
Location: United States
Hello Tom,
ImageLoad is designed to handle one image file per call. Here is an example of loading all images in a folder specified by the user (Newpath) and where the file names have the suffix ".tif":
I hope this helps,
A.G.
WaveMetrics, Inc.