function fimage
%Version 4/3/09 This opens the window where the user enters the general
%characteristics of the image files, i.e. the naming conventions and the image bit
%depth.
global fontpics bitdepth m5f m5b
global h_Ysuffix h_Fsuffix h_Csuffix h_Dsuffix h_imagefig
global Ysuffix Fsuffix Csuffix Dsuffix darkgreen
m5f = 'black'; m5b = 'white';
x = .3; y = .4; w = .4; h = .4;
h_imagefig = figure('Color', darkgreen, 'units','normalized','name','Image Properties','ToolBar','none','NumberTitle','off','menubar','none','position',[ x y w h ] );
uicontrol( 'units', 'normalized', 'style', 'text', ...
'string', 'Image bit depth', 'position', [ 1/20 21/24 9/20 1/12 ], 'fontsize', fontpics,'back', m5f, 'fore', m5b );
if bitdepth == 8
h_image.u0 = uicontrol( 'units', 'normalized', 'style', 'radiobutton', 'string', '8-bit', ...
'position', [ 11/20 21/24 .13 1/12 ], 'fontsize', fontpics,'value',1);
h_image.u1 = uicontrol( 'units', 'normalized', 'style', 'radiobutton', 'string', '12-bit', ...
'position', [ 14/20 21/24 .13 1/12 ], 'fontsize', fontpics,'value',0);
h_image.u2 = uicontrol( 'units', 'normalized', 'style', 'radiobutton', 'string', '16-bit', ...
'position', [ 17/20 21/24 .13 1/12 ], 'fontsize', fontpics,'value',0 );
elseif bitdepth == 12
h_image.u0 = uicontrol( 'units', 'normalized', 'style', 'radiobutton', 'string', '8-bit', ...
'position', [ 11/20 21/24 .13 1/12 ], 'fontsize', fontpics,'value',0 );
h_image.u1 = uicontrol( 'units', 'normalized', 'style', 'radiobutton', 'string', '12-bit', ...
'position', [ 14/20 21/24 .13 1/12 ], 'fontsize', fontpics,'value',1);
h_image.u2 = uicontrol( 'units', 'normalized', 'style', 'radiobutton', 'string', '16-bit', ...
'position', [ 17/20 21/24 .13 1/12 ], 'fontsize', fontpics,'value',0 );
else
h_image.u0 = uicontrol( 'units', 'normalized', 'style', 'radiobutton', 'string', '8-bit', ...
'position', [ 11/20 21/24 .13 1/12 ], 'fontsize', fontpics,'value',0 );
h_image.u1 = uicontrol( 'units', 'normalized', 'style', 'radiobutton', 'string', '12-bit', ...
'position', [ 14/20 21/24 .13 1/12 ], 'fontsize', fontpics,'value',0);
h_image.u2 = uicontrol( 'units', 'normalized', 'style', 'radiobutton', 'string', '16-bit', ...
'position', [ 17/20 21/24 .13 1/12 ], 'fontsize', fontpics,'value',1 );
end;
set( h_image.u0, 'callback', {@fimage_callback, h_image, 1 } );
set( h_image.u1, 'callback', {@fimage_callback, h_image, 2 } );
set( h_image.u2, 'callback', {@fimage_callback, h_image, 3 } );
if bitdepth == 8
set( h_image.u0, 'value', 1 );
elseif bitdepth == 12
set( h_image.u1, 'value', 1 );
else
set( h_image.u2, 'value', 1 );
end
uicontrol( 'units', 'normalized', 'style', 'text', 'string', 'YFP file identifier', 'position', [ 1/20 18/24 9/20 1/12 ], 'fontsize', fontpics,'back', m5f, 'fore', m5b );
uicontrol( 'units', 'normalized', 'style', 'text', 'string', 'FRET file identifier', 'position', [ 1/20 15/24 9/20 1/12 ], 'fontsize', fontpics,'back', m5f, 'fore', m5b );
uicontrol( 'units', 'normalized', 'style', 'text', 'string', 'CFP file identifier', 'position', [ 1/20 12/24 9/20 1/12 ], 'fontsize', fontpics,'back', m5f, 'fore', m5b );
uicontrol( 'units', 'normalized', 'style', 'text', 'string', 'DIC file identifier', 'position', [ 1/20 9/24 9/20 1/12 ], 'fontsize', fontpics,'back', m5f, 'fore', m5b );
h_Ysuffix = uicontrol(h_imagefig, 'units', 'normalized',...
'style', 'edit', 'string', Ysuffix, 'position', [ 11/20 18/24 8/20 1/12 ],...
'back', m5b, 'fore', m5f, 'fontsize', fontpics );
h_Fsuffix = uicontrol(h_imagefig, 'units', 'normalized',...
'style', 'edit', 'string', Fsuffix, 'position', [ 11/20 15/24 8/20 1/12 ],...
'back', m5b, 'fore', m5f, 'fontsize', fontpics );
h_Csuffix = uicontrol(h_imagefig, 'units', 'normalized',...
'style', 'edit', 'string', Csuffix, 'position', [ 11/20 12/24 8/20 1/12 ],...
'back', m5b, 'fore', m5f, 'fontsize', fontpics );
h_Dsuffix = uicontrol(h_imagefig, 'units', 'normalized',...
'style', 'edit', 'string', Dsuffix, 'position', [ 11/20 9/24 8/20 1/12 ],...
'back', m5b, 'fore', m5f, 'fontsize', fontpics );
uicontrol( 'style','pushbutton', 'units', 'normalized', 'string','Done',...
'position',[ 1/3 4/24 1/3 1/12 ], 'callback',@suffix_callback, 'fontsize', fontpics );
function suffix_callback( gcf, eventdata, handles )
global h_Ysuffix h_Fsuffix h_Csuffix h_Dsuffix h_imagefig
global Ysuffix Fsuffix Csuffix Dsuffix
Ysuffix = get( h_Ysuffix, 'string' );
splitYx = regexp(Ysuffix,'\ ','freespacing','split');%in case the user accidentally adds spaces to name, they get removed.
Ysuffix = [splitYx{:}];
if(isempty(Ysuffix) == 1)
Ysuffix = '500_545';
end;
Fsuffix = get( h_Fsuffix, 'string' );
splitFx = regexp(Fsuffix,'\ ','freespacing','split');
Fsuffix = [splitFx{:}];
if(isempty(Fsuffix) == 1)
Fsuffix = '440_545';
end;
Csuffix = get( h_Csuffix, 'string' );
splitCx = regexp(Csuffix,'\ ','freespacing','split');
Csuffix = [splitCx{:}];
if(isempty(Csuffix) == 1)
Csuffix = '440_480';
end;
Dsuffix = get( h_Dsuffix, 'string' );
splitDx = regexp(Dsuffix,'\ ','freespacing','split');
Dsuffix = [splitDx{:}];
if(isempty(Dsuffix) == 1)
Dsuffix = '0_500';
end;
close(h_imagefig)
if strcmp(Ysuffix,Fsuffix) == 1 || strcmp(Ysuffix,Csuffix) == 1 || strcmp(Fsuffix,Csuffix)==1
fquestimage1;
elseif strcmp(Dsuffix,Ysuffix) == 1 || strcmp(Dsuffix,Fsuffix) == 1 || strcmp(Dsuffix,Csuffix)== 1
fquestimage1;%use to be fquestimage2
else
fupdate;
end
function fimage_callback( gcf, eventdata, handles, radio_value )
global bitdepth
switch radio_value
case 1
bitdepth = 8;
set( handles.u0, 'value', 1 ); set( handles.u1, 'value', 0 ); set( handles.u2, 'value', 0 );
case 2
bitdepth = 12;
set( handles.u0, 'value', 0 );set( handles.u1, 'value', 1 ); set( handles.u2, 'value', 0 );
case 3
bitdepth = 16;
set( handles.u0, 'value', 0 ); set( handles.u1, 'value', 0 );set( handles.u2, 'value', 1 );
end;