File Loader

Project:Semi-Automated Routines for Functional Image Analysis (SARFIA)
Version:IGOR.6.12.x-1.05
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi, I need to change the way the program load files, on the "loadMovie"feature. My files are in this format "filename_t00*_ch00.tiff"with the _t00* going from 0 to other numbers(450). Every number is a single timepoint. In SARFIA it is possible to load files that end in 000.tiff. How can I change this??
Thanks

#1

The easiest workaround would be to use a batch renaming program (several freeware programs are available for Windows; on Mac simply use Automator) to adjust the filenames.

Recoding Igor to be both flexible and recognize your specific filenames is a bit tricky.
The function in question is LoadMovie() in the procedure file LoadScanImage.ipf and the relevant parts of the code look like this:

StrNum=FileName[strlen(FileName)-3,strlen(FileName)-1]	//last 3 characters in FileName
StartNum=Str2Num(StrNum)
if(NumType(StartNum==2))
			DoAlert 0, "The last three characters of the filename are not numbers."
			return "-1"
endif
FNTrunc = FileName[0,strlen(FileName)-4]   //retrieves the root of the filename (removes extension)
 
[..]//some code here
 
FileName = 	FnPath+FNTrunc+FNNum+".tif"

Here I am extracting the rightmost 3 characters of a filename to extract them as the index. You could change that code to 3 digits at a different position in the filename. Obviously, if the length of the filename after the index numbers changes, this won't wor anymore either.

I recommend you to copy-paste the whole function into a new procedure window and give it a new name before you start editing.

StrNum=FileName[Strlen(FileName)-8,Strlen(FileName)-6]	//Now gets the numbering from characters 6 to 8 from the right
StartNum=Str2Num(StrNum)
if(NumType(StartNum==2))
			DoAlert 0, "The last three characters of the filename are not numbers."
			return "-1"
endif
FNTrunc = FileName[0,Strlen(FileName)-9]+FileName[Strlen(FileName)-5,Strlen(FileName)-1]   //reassembles filename minus the 3 digits used in indexing
 
[..]//some code here
 
FileName = 	FnPath+FNTrunc[0,Strlen(FNTrunc)-6]+FNNum+FNTrunc[Strlen(FNTrunc)-5,Strlen(FNTrunc)-1]+".tif" // reassembles complete filename for loading

This code will work if right appendix if 5 characters long, as in filename_t00*_ch00.tif (the underscore is counted, too). You can change the numbering accordingly.

Also, note that the function is expecting a 3 character extension, i.e. "tif", not "tiff". This, too can be changed in the code, or by using a batch renaming program.

Back to top