Ignore:
Timestamp:
Mar 27, 2025, 5:59:21 PM (3 weeks ago)
Author:
sommeria
Message:

various bugs repaired,Relabeling frames installed for multitif

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/get_file_info.m

    r1178 r1180  
    1 %'get_file_info': determine info about a file (image, multimage, civdata,...) . 
     1%'get_file_info': determine info about a file (image, multimage, civdata,...) .
    22%------------------------------------------------------------------------
    33% [FileInfo,VideoObject]=get_file_info(fileinput)
     
    1919%               ='cine_phantom': images from fast camera Phantom
    2020%               ='bin': binary file without specific organisation
    21 %               ='netcdf': netcdf file 
     21%               ='netcdf': netcdf file
    2222%               ='civdata': netcdf files provided by civ_series
    2323%               ='civx': netcdf files provided by the obsolete program civx (in fortran)
     
    6969    return %input file does not exist.
    7070end
    71 [tild,tild,FileExt]=fileparts(fileinput);%get the file extension FileExt
     71[~,~,FileExt]=fileparts(fileinput);%get the file extension FileExt
    7272
    7373switch FileExt
     
    128128        FileInfo.TimeName='video';
    129129    case '.hcc'
    130         %cd 'TelopsToolbox_20230707(r20340)'
    131          installToolboxIRCAM
     130        installToolboxIRCAM
    132131        [~,InfoArray]=readIRCam(fileinput,'HeadersOnly',true);
    133          FileInfo.FileType='telopsIR';
    134          FileInfo.Height=InfoArray(1).Height;
    135          FileInfo.Width=InfoArray(1).Width;
    136          FileInfo.FrameRate=InfoArray(1).AcquisitionFrameRate;
    137          FileInfo.NumberOfFrames=numel(InfoArray);
    138          FileInfo.TimeName='video';
     132        FileInfo.FileType='telopsIR';
     133        FileInfo.Height=InfoArray(1).Height;
     134        FileInfo.Width=InfoArray(1).Width;
     135        FileInfo.FrameRate=InfoArray(1).AcquisitionFrameRate;
     136        FileInfo.NumberOfFrames=numel(InfoArray);
     137        FileInfo.TimeName='video';
     138        Path=fileparts(fileinput);% look for the xml file to document theb file series
     139        [RootPath,SubDir,DirExt]=fileparts(Path);
     140        if ~isempty(DirExt)
     141            disp(['ERROR: change the name of the folder containing the image files: no file extension ' DirExt])
     142            FileInfo.FileType='error';
     143            return
     144        end
     145        XmlFile=fullfile(RootPath,[SubDir '.xml']);
     146        CheckWriteImaDoc=true;
     147        if exist(XmlFile,'file')
     148            [XmlData,~,errormsg]=xml2struct(XmlFile);
     149            if ~isempty(errormsg)
     150                disp(errormsg)
     151                FileInfo.FileType='error';
     152                return
     153            elseif isfield(XmlData,'FileSeries')
     154                CheckWriteImaDoc=false;
     155            end
     156        end
     157        if CheckWriteImaDoc
     158            DirContent=dir(Path);
     159            NbFiles=0;
     160            FileSeries.Convention='telopsIR';
     161            for ilist=1:numel(DirContent)
     162                FName=DirContent(ilist).name;
     163                if ~isempty(regexp(FName,'.hcc$', 'once'))
     164                    NbFiles=NbFiles+1;
     165                    FileSeries.FileName{NbFiles,1}=FName;
     166                end
     167            end
     168            FileSeries.NbFramePerFile=FileInfo.NumberOfFrames;
     169            [checkupdate,xmlfile,errormsg]=update_imadoc(RootPath,SubDir,'FileSeries',FileSeries);
     170        end
     171
    139172    otherwise
    140173        if ~isempty(FileExt)% exclude empty extension
     
    160193                        FileInfo.error=ME.message;
    161194                    end
     195
    162196                else
    163197                    error_nc=0;
     
    205239                                end
    206240                                FileInfo.ListDimName=Data.ListDimName;
    207 %                                 FileInfo.NumberOfFrames=Data.DimValue;
     241                                %                                 FileInfo.NumberOfFrames=Data.DimValue;
    208242                            end
    209243                        else
     
    218252                                INFO=mmfileinfo (fileinput);
    219253                                if  ~isempty(INFO.Video.Format)
    220                                    
    221254                                    VideoObject=mmreader(fileinput);
    222255                                    FileInfo=get(VideoObject);
Note: See TracChangeset for help on using the changeset viewer.