Changeset 972 for trunk


Ignore:
Timestamp:
Nov 15, 2016, 5:22:14 PM (4 years ago)
Author:
sommeria
Message:

multitif updated

Location:
trunk/src
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/mouse_motion.m

    r970 r972  
    224224                    sin_om=sin(pi*om/180);
    225225                    pos=[xy(1,1) xy(1,2) 0];
    226                     pos=cos_om*pos+sin_om*cross(OmAxis,pos)+(1-cos_om)*(OmAxis*pos')*OmAxis;
    227                 end
    228                pos=pos+Field.ProjObjectCoord;
     226                    %pos=cos_om*pos+sin_om*cross(OmAxis,pos)+(1-cos_om)*(OmAxis*pos')*OmAxis;
     227                    coeff=OmAxis(3)*(1-cos_om);
     228                    norm_plane(1)=OmAxis(1)*coeff+OmAxis(2)*sin_om;
     229                    norm_plane(2)=OmAxis(2)*coeff-OmAxis(1)*sin_om;
     230                    norm_plane(3)=OmAxis(3)*coeff+cos_om;
     231                    %Z0=norm_plane*Field.ProjObjectCoord'/norm_plane(3);
     232                    pos(3)=-(norm_plane(1)*pos(1)-norm_plane(2)*pos(2))/norm_plane(3);                               
     233                end
     234                pos=pos+Field.ProjObjectCoord;
    229235                text_displ_3=[text_displ_3 'x,y,z=' num2str(pos,4)];
    230236            end
  • trunk/src/phys_XYZ.m

    r924 r972  
    4141        norm_plane(2)=OmAxis(2)*coeff-OmAxis(1)*sin_om;
    4242        norm_plane(3)=OmAxis(3)*coeff+cos_om;
    43         Z0=norm_plane*Calib.SliceCoord(Zindex,:)'/norm_plane(3);
    44     else
     43%         Z0=norm_plane*Calib.SliceCoord(Zindex,:)'/norm_plane(3);
     44    end
    4545        Z0=Calib.SliceCoord(Zindex,3);%horizontal plane z=cte
    46     end
     46%     end
    4747    Z0virt=Z0;
    4848    if isfield(Calib,'InterfaceCoord') && isfield(Calib,'RefractionIndex')
  • trunk/src/phys_ima.m

    r970 r972  
    6161        [Rangx]=phys_XYZ(Calib,Rangx,[0.5 0.5],ZIndex);%case of translations without rotation and quadratic deformation
    6262        [xx,Rangy]=phys_XYZ(Calib,[0.5 0.5],Rangy,ZIndex);
    63     else         
     63    else
    6464        % the image needs to be interpolated to the new coordinates
    6565        zphys=0; %default
    6666        if isfield(Calib,'SliceCoord') %.Z= index of plane
    67            SliceCoord=Calib.SliceCoord(ZIndex,:);
    68            zphys=SliceCoord(3); %to generalize for non-parallel planes
    69            
    70 %         if isfield(Calib,'SliceAngle')&&~isequal(Calib.SliceAngle,[0 0 0])
    71 %                     om=norm(Calib.SliceAngle);%norm of rotation angle in radians
    72 %                     OmAxis=Calib.SliceAngle/om; %unit vector marking the rotation axis
    73 %                     cos_om=cos(pi*om/180);
    74 %                     sin_om=sin(pi*om/180);
    75 %                     pos=[xy(1,1) xy(1,2) 0];
    76 %                     pos=cos_om*pos+sin_om*cross(OmAxis,pos)+(1-cos_om)*(OmAxis*pos')*OmAxis;
    77 %                 end
    78            
    79            
    80 %            if isfield(Calib,'InterfaceCoord') && isfield(Calib,'RefractionIndex')
     67            SliceCoord=Calib.SliceCoord(ZIndex,:);
     68            zphys=SliceCoord(3); %to generalize for non-parallel planes
     69            if isfield(Calib, 'SliceAngle') && ~isequal(Calib.SliceAngle,[0 0 0]) && ~isequal(Calib.SliceAngle(ZIndex,:),[0 0 0])
     70                testangle=1;
     71                om=norm(Calib.SliceAngle(ZIndex,:));%norm of rotation angle in radians
     72                OmAxis=Calib.SliceAngle(ZIndex,:)/om; %unit vector marking the rotation axis
     73                cos_om=cos(pi*om/180);
     74                sin_om=sin(pi*om/180);
     75                coeff=OmAxis(3)*(1-cos_om);
     76                norm_plane(1)=OmAxis(1)*coeff+OmAxis(2)*sin_om;
     77                norm_plane(2)=OmAxis(2)*coeff-OmAxis(1)*sin_om;
     78                norm_plane(3)=OmAxis(3)*coeff+cos_om;
     79                %Z0=norm_plane*Calib.SliceCoord(ZIndex,:)'/norm_plane(3);
     80                Z0=Calib.SliceCoord(ZIndex,3);
     81                zphys=Z0-(norm_plane(1)*X-norm_plane(2)*Y)/norm_plane(3);
     82            end
     83%             if isfield(Calib,'InterfaceCoord') && isfield(Calib,'RefractionIndex')
    8184%                 H=Calib.InterfaceCoord(3);
    8285%                 if H>zphys
    8386%                     zphys=H-(H-zphys)/Calib.RefractionIndex; %corrected z (virtual object)
    8487%                 end
    85 %            end
     88%             end
    8689        end
    8790        xima=0.5:npx(icell)-0.5;%image coordinates of corners
  • trunk/src/series.m

    r970 r972  
    27142714end
    27152715
     2716
    27162717function [TimeValue,DtValue]=get_time(ref_i,ref_j,PairString,InputTable,FileInfo,TimeName,DtName)
    27172718[i1,i2,j1,j2] = get_file_index(ref_i,ref_j,PairString);
     
    34863487
    34873488% --- Executes on button press in SetPairs.
    3488 function SetPairs_Callback(hObject, iview, handles)
     3489function SetPairs_Callback(hObject, eventdata, handles)
    34893490
    34903491%% delete previous occurrence of 'set_pairs'
     
    35103511ListViewLines=find(cellfun('isempty',PairString)==0);%find list of non empty pairs
    35113512ListViewMenu=cell(numel(ListViewLines),1);
     3513iview=get(handles.PairString,'Value');
    35123514for ilist=1:numel(ListViewLines)
    35133515    ListViewMenu{ilist}=num2str(ListViewLines(ilist));
  • trunk/src/series/extract_multitif.m

    r971 r972  
    5959%=======================================================================
    6060
    61 function ParamOut=ima2netcdf(Param)
     61function ParamOut=extract_multitif(Param)
    6262
    6363%%%%%%%%%%%%%%%%%    INPUT PREPARATION MODE (no RUN)    %%%%%%%%%%%%%%%%%
     
    7373    ParamOut.OutputDirExt='.png';%set the output dir extension
    7474    ParamOut.OutputFileMode='NbSlice';% '=NbInput': 1 output file per input file index, '=NbInput_i': 1 file per input file index i, '=NbSlice': 1 file per slice
    75    
     75     ParamOut.CheckOverwriteVisible='on'; % manage the overwrite of existing files (default=1)
    7676    %% root input file(s) and type
    7777    % check the existence of the first file in the series
     
    148148%count=316;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%CORRECTION EXP08: 4684 images -> start at 316 start 67->_11_1
    149149%count=1934%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%CORRECTION EXP07: 3066 images
    150 %% loop on the files
     150%% loop on the files  
    151151for ifile=1:numel(ListFile)
    152152    update_waitbar(WaitbarHandle,ifile/numel(ListFile))
     
    158158    NbFrames=numel(imfinfo(ImageName));
    159159    % loop on the frames within the tiff file
    160     for iframe=1:NbFrames     
    161         A=imread(ImageName,iframe);
    162 
    163         if isequal(ImagesPerLevel,1)% mode series
     160    for iframe=1:NbFrames       
     161        if isequal(ImagesPerLevel,1)% mode series
    164162            i_index=count+1;
    165163            OutputFile=fullfile(OutputDir,['img_' num2str(count+1) '.png']);
    166         else % indices i and j 
     164        else % indices i and j
    167165            i_index=fix(count/ImagesPerLevel)+1;
    168166            j_index=mod(count,ImagesPerLevel)+1;
    169167            OutputFile=fullfile(OutputDir,['img_' num2str(i_index) '_' num2str(j_index) '.png']);
    170168        end
    171         imwrite(A,OutputFile,'BitDepth',16)
     169        if Param.CheckOverwrite ||~exist(OutputFile,'file')
     170            A=imread(ImageName,iframe);
     171            imwrite(A,OutputFile,'BitDepth',16);
     172            disp([OutputFile ' written'])
     173        else
     174            disp([OutputFile ' already exists'])
     175        end
    172176        count=count+1;
    173177    end
    174178end
     179
     180% for ifile=1:numel(ListFile)
     181%     update_waitbar(WaitbarHandle,ifile/numel(ListFile))
     182%     if ~isempty(RUNHandle)&& ~strcmp(get(RUNHandle,'BusyAction'),'queue')
     183%         disp('program stopped by user')
     184%         break
     185%     end
     186%     ImageName=fullfile(DirImages,ListFile{ifile});
     187%     NbFrames=numel(imfinfo(ImageName));
     188%     % loop on the frames within the tiff file
     189%     for iframe=1:NbFrames     
     190%         A=imread(ImageName,iframe);
     191%
     192%         if isequal(ImagesPerLevel,1)% mode series
     193%             i_index=count+1;
     194%             OutputFile=fullfile(OutputDir,['img_' num2str(count+1) '.png']);
     195%         else % indices i and j
     196%             i_index=fix(count/ImagesPerLevel)+1;
     197%             j_index=mod(count,ImagesPerLevel)+1;
     198%             OutputFile=fullfile(OutputDir,['img_' num2str(i_index) '_' num2str(j_index) '.png']);
     199%         end
     200%         imwrite(A,OutputFile,'BitDepth',16)
     201%         count=count+1;
     202%     end
     203% end
    175204
    176205%% create the xml file of PCO camera
     
    181210
    182211%% remove initial files if transfer OK
    183     if i_index== (size(XmlInput.Time,1)-1)
    184 
    185         [SUCCESS,MESSAGE]=rmdir(DirImages,'s')
    186        
    187     end
     212%     if i_index== (size(XmlInput.Time,1)-1)
     213%
     214%         [SUCCESS,MESSAGE]=rmdir(DirImages,'s')
     215%        
     216%     end
  • trunk/src/transform_field/ima_color2BW.m

    r924 r972  
    3030DataOut=DataIn; %default
    3131if ndims(DataOut.A)==3
    32     DataOut.A=uint16(sum(double(DataOut.A,3)));%sum on color components, transform in 16 bit BW images
     32    DataOut.A=uint16(sum(double(DataOut.A),3));%sum on color components, transform in 16 bit BW images
    3333end
    3434 
  • trunk/src/uvmat.m

    r968 r972  
    11771177    'String',num2str(SliceAngle(1)),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_SliceAngle_1_1'':first slice angle of inclination around the x axis');%edit box
    11781178uicontrol('Style','edit','Units','normalized', 'Position', [4*ii+3*ww 0.95-5*ii-4.2*hh ww hh],'tag','num_SliceAngle_1_2','BackgroundColor',[1 1 1],...
    1179     'String',num2str(SliceAngle(2)),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_SliceAngle_1_2'':last slice angle of inclination around the x axis');%edit box
     1179    'String',num2str(SliceAngle(1)),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_SliceAngle_1_2'':last slice angle of inclination around the x axis');%edit box
    11801180uicontrol('Style','edit','Units','normalized', 'Position', [3*ii+2*ww 0.95-6*ii-5.2*hh ww hh],'tag','num_SliceAngle_2_1','BackgroundColor',[1 1 1],...
    1181     'String',num2str(SliceAngle(1)),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_SliceAngle_2_1'':first slice angle of inclination around the y axis');%edit box
     1181    'String',num2str(SliceAngle(2)),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_SliceAngle_2_1'':first slice angle of inclination around the y axis');%edit box
    11821182uicontrol('Style','edit','Units','normalized', 'Position', [4*ii+3*ww 0.95-6*ii-5.2*hh ww hh],'tag','num_SliceAngle_2_2','BackgroundColor',[1 1 1],...
    11831183    'String',num2str(SliceAngle(2)),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_SliceAngle_2_2'':last slice angle of inclination around the y axis');%edit box
     
    12691269uvmat('InputFileREFRESH_Callback',huvmat,[],hhuvmat); %file input with xml reading  in uvmat, show the image in phys coordinates
    12701270set(hObject,'BackgroundColor',[1 0 0]);% paint button back to red
     1271
     1272delete(hset_slice)
    12711273
    12721274%------------------------------------------------------------------------
     
    13381340function set_slice_Cancel_Callback(hObject,eventdata)
    13391341%------------------------------------------------------------------------
    1340 hfig=get(hObject,'parent');
    1341 delete(hfig)
     1342hset_slice=get(hObject,'parent');
     1343delete(hset_slice)
    13421344
    13431345%-----------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.