Index: /trunk/src/geometry_calib.m
===================================================================
--- /trunk/src/geometry_calib.m	(revision 723)
+++ /trunk/src/geometry_calib.m	(revision 724)
@@ -283,7 +283,9 @@
 %------------------------------------------------------------------------
 %% read the current calibration points
+index=[];
 Coord=get(handles.ListCoord,'Data');
 Coord(:,6)=[];
 % apply the calibration, whose type is selected in  handles.calib_type
+GeometryCalib=[];
 if ~isempty(Coord)
     calib_cell=get(handles.calib_type,'String');
@@ -292,6 +294,8 @@
 else
     msgbox_uvmat('ERROR','No calibration points, abort')
+end 
+if isempty(GeometryCalib)
     return
-end 
+end
 Z_plane=[];
 if ~isempty(Coord)
@@ -542,17 +546,22 @@
 center_optim=0;
 run(fullfile(path_UVMAT,'toolbox_calib','go_calib_optim'));% apply fct 'toolbox_calib/go_calib_optim'
-GeometryCalib.CalibrationType='3D_linear';
-GeometryCalib.fx_fy=fc';
-GeometryCalib.Cx_Cy=cc';
-GeometryCalib.kc=kc(1);
-GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function
-GeometryCalib.Tx_Ty_Tz=Tc_1';
-GeometryCalib.R=Rc_1;
-GeometryCalib.R(2,1:3)=-GeometryCalib.R(2,1:3);%inversion of the y image coordinate
-GeometryCalib.Tx_Ty_Tz(2)=-GeometryCalib.Tx_Ty_Tz(2);%inversion of the y image coordinate
-GeometryCalib.Cx_Cy(2)=ny-GeometryCalib.Cx_Cy(2);%inversion of the y image coordinate
-GeometryCalib.omc=(180/pi)*omc_1;%angles in degrees
-GeometryCalib.ErrorRMS=[];
-GeometryCalib.ErrorMax=[];
+if exist('Rc_1','var')
+    GeometryCalib.CalibrationType='3D_linear';
+    GeometryCalib.fx_fy=fc';
+    GeometryCalib.Cx_Cy=cc';
+    GeometryCalib.kc=kc(1);
+    GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function
+    GeometryCalib.Tx_Ty_Tz=Tc_1';
+    GeometryCalib.R=Rc_1;
+    GeometryCalib.R(2,1:3)=-GeometryCalib.R(2,1:3);%inversion of the y image coordinate
+    GeometryCalib.Tx_Ty_Tz(2)=-GeometryCalib.Tx_Ty_Tz(2);%inversion of the y image coordinate
+    GeometryCalib.Cx_Cy(2)=ny-GeometryCalib.Cx_Cy(2);%inversion of the y image coordinate
+    GeometryCalib.omc=(180/pi)*omc_1;%angles in degrees
+    GeometryCalib.ErrorRMS=[];
+    GeometryCalib.ErrorMax=[];
+else
+    msgbox_uvmat('ERROR',['calibration function ' fullfile('toolbox_calib','go_calib_optim') ' did not converge: use multiple views or option 3D_extrinsic'])
+    GeometryCalib=[];
+end
 
 %------------------------------------------------------------------------
@@ -609,22 +618,22 @@
 run(fullfile(path_UVMAT,'toolbox_calib','go_calib_optim'));% apply fct 'toolbox_calib/go_calib_optim'
 
-GeometryCalib.CalibrationType='3D_quadr';
-GeometryCalib.fx_fy=fc';
-GeometryCalib.Cx_Cy=cc';
-GeometryCalib.kc=kc(1);
-GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function
-GeometryCalib.Tx_Ty_Tz=Tc_1';
-if ~exist('Rc_1','var')
-    msgbox_uvmat('ERROR',['calibration function ' fullfile('toolbox_calib','go_calib_optim') ' did not converge: use multiple views or option 3D_extrinsic']) 
-    return
-end
-GeometryCalib.R=Rc_1;
-GeometryCalib.R(2,1:3)=-GeometryCalib.R(2,1:3);%inversion of the y image coordinate
-GeometryCalib.Tx_Ty_Tz(2)=-GeometryCalib.Tx_Ty_Tz(2);%inversion of the y image coordinate
-GeometryCalib.Cx_Cy(2)=ny-GeometryCalib.Cx_Cy(2);%inversion of the y image coordinate
-GeometryCalib.omc=(180/pi)*omc_1;%angles in degrees
-GeometryCalib.ErrorRMS=[];
-GeometryCalib.ErrorMax=[];
-
+if exist('Rc_1','var')
+    GeometryCalib.CalibrationType='3D_quadr';
+    GeometryCalib.fx_fy=fc';
+    GeometryCalib.Cx_Cy=cc';
+    GeometryCalib.kc=kc(1);
+    GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function
+    GeometryCalib.Tx_Ty_Tz=Tc_1';
+    GeometryCalib.R=Rc_1;
+    GeometryCalib.R(2,1:3)=-GeometryCalib.R(2,1:3);%inversion of the y image coordinate
+    GeometryCalib.Tx_Ty_Tz(2)=-GeometryCalib.Tx_Ty_Tz(2);%inversion of the y image coordinate
+    GeometryCalib.Cx_Cy(2)=ny-GeometryCalib.Cx_Cy(2);%inversion of the y image coordinate
+    GeometryCalib.omc=(180/pi)*omc_1;%angles in degrees
+    GeometryCalib.ErrorRMS=[];
+    GeometryCalib.ErrorMax=[];
+else
+    msgbox_uvmat('ERROR',['calibration function ' fullfile('toolbox_calib','go_calib_optim') ' did not converge: use multiple views or option 3D_extrinsic'])
+    GeometryCalib=[];
+end
 
 %------------------------------------------------------------------------
@@ -633,5 +642,5 @@
 path_uvmat=which('geometry_calib');% check the path detected for source file uvmat
 path_UVMAT=fileparts(path_uvmat); %path to UVMAT
-x_1=double(Coord(:,4:5)');%image coordiantes
+x_1=double(Coord(:,4:5)');%image coordinates
 X_1=double(Coord(:,1:3)');% phys coordinates
 huvmat=findobj(allchild(0),'Tag','uvmat');
@@ -641,4 +650,23 @@
 n_ima=1;
 GeometryCalib.CalibrationType='3D_extrinsic';
+fx=str2num(get(handles.fx,'String'));
+fy=str2num(get(handles.fy,'String'));
+Cx=str2num(get(handles.Cx,'String'));
+Cy=str2num(get(handles.Cy,'String'));
+errormsg='';
+if isempty(fx)
+    errormsg='focal length fx needs to be introduced';
+elseif isempty(fy)
+    errormsg='focal length fy needs to be introduced';
+elseif isempty(Cx)
+    errormsg='shift Cx to image centre needs to be introduced';
+elseif isempty(Cy)
+    errormsg='shift Cy to image centre needs to be introduced';
+end
+if ~isempty(errormsg)
+    GeometryCalib=[];
+    msgbox_uvmat('ERROR',errormsg)
+    return
+end
 GeometryCalib.fx_fy(1)=str2num(get(handles.fx,'String'));
 GeometryCalib.fx_fy(2)=str2num(get(handles.fy,'String'));
@@ -660,7 +688,4 @@
 GeometryCalib.Cx_Cy(2)=ny-GeometryCalib.Cx_Cy(2);%inversion of the y image coordinate
 GeometryCalib.omc=(180/pi)*omc';
-%GeometryCalib.R(3,1:3)=-GeometryCalib.R(3,1:3);%inversion for z upward
-
-
 
 %------------------------------------------------------------------------
@@ -1161,5 +1186,5 @@
         set(handles.Psi,'String',num2str(GeometryCalib.omc(3),4))
     end
-    if isfield(GeometryCalib,'SourceCalib')
+    if isfield(GeometryCalib,'SourceCalib')&& isfield(GeometryCalib.SourceCalib,'PointCoord')
         calib=GeometryCalib.SourceCalib.PointCoord;
         Coord=[calib zeros(size(calib,1),1)];
Index: /trunk/src/series/civ_series.m
===================================================================
--- /trunk/src/series/civ_series.m	(revision 723)
+++ /trunk/src/series/civ_series.m	(revision 724)
@@ -38,5 +38,5 @@
 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 
-function [Data,errormsg,result_conv]= civ_series(Param,ncfile)
+function [Data,errormsg,result_conv]= civ_series(Param)
 errormsg='';
 path_series=fileparts(which('series'));
