diff --git a/batch/trackOptiResize.m b/batch/trackOptiResize.m index e013ac0..584961b 100644 --- a/batch/trackOptiResize.m +++ b/batch/trackOptiResize.m @@ -50,7 +50,7 @@ image_name = contents(i).name; image_folder = contents(i).folder; disp(image_name); - im = imread([image_folder,'/',image_name]); + im = intImRead([image_folder,'/',image_name]); out_name = [targetd, image_name]; imwrite(imresize(im,scale), out_name, 'TIFF'); end diff --git a/batch/trackOptiSkipMerge.m b/batch/trackOptiSkipMerge.m index 3938d81..c5d853d 100644 --- a/batch/trackOptiSkipMerge.m +++ b/batch/trackOptiSkipMerge.m @@ -142,7 +142,7 @@ function intSkipPar(i,dirname_xy,nameInfo,nt,nc,nz,skip,num_c,num_z) for k = 2:num_z nameInfo_tmp.npos(4,1) = nz(k); name = MakeFileName(nameInfo_tmp); - phase = min(phase, double(imread( [dirname_xy,'phase',filesep,name] ))); + phase = min(phase, double(intImRead( [dirname_xy,'phase',filesep,name] ))); end % Loads the reference _err file for the image already segmented @@ -174,7 +174,7 @@ function intSkipPar(i,dirname_xy,nameInfo,nt,nc,nz,skip,num_c,num_z) nameInfo_tmp.npos(2,1) = nc(k); nameInfo_tmp.npos(4,1) = 1; name = MakeFileName( nameInfo_tmp ); - fluorImage = imread( [dirname_xy,'fluor',num2str(nc(k)-1),filesep,name]); + fluorImage = intImRead( [dirname_xy,'fluor',num2str(nc(k)-1),filesep,name]); data.(['fluor',num2str(nc(k)-1)]) = fluorImage; imRange(:,k) = intRange( fluorImage(:) ); diff --git a/batch/tryDifferentConstants.m b/batch/tryDifferentConstants.m index 924f05d..c557388 100644 --- a/batch/tryDifferentConstants.m +++ b/batch/tryDifferentConstants.m @@ -42,7 +42,7 @@ % imfinfo() if strcmp(filename(end-3:end), '.tif') - tempImage = imread(filename); + tempImage = intImRead(filename); else % it is a folder filename = fixDir(filename); images = dir([filename,'*c1*.tif']); @@ -55,7 +55,7 @@ else lastPhaseImage = images(end).name; end - tempImage = imread([filename,lastPhaseImage]); + tempImage = intImRead([filename,lastPhaseImage]); end phase = intCropImage (tempImage); diff --git a/dev-lab/trackOptiZMerge.m b/dev-lab/trackOptiZMerge.m index 28e677a..f5aabfa 100644 --- a/dev-lab/trackOptiZMerge.m +++ b/dev-lab/trackOptiZMerge.m @@ -77,7 +77,7 @@ function trackOptiZMerge( dirname, targetname, CONST, dz ) %% Load up first images and get the size -im = imread( [dirname,contents(1).name] ); +im = intImRead( [dirname,contents(1).name] ); if numel(size(im)) > 2 im = im(:,:,2); @@ -162,7 +162,7 @@ function intDoTimeStep( it, data, nnxy ) nameInfo_in.npos(:,1) = [it; ic; nnxy; iz]; in_name = [data.dirname, MakeFileName(nameInfo_in)]; - tmp = imread( in_name ); + tmp = intImRead( in_name ); if numel(size(tmp)) > 2 tmp = tmp(:,:,2); diff --git a/segmentation/doSeg.m b/segmentation/doSeg.m index abf86fd..a9257f8 100644 --- a/segmentation/doSeg.m +++ b/segmentation/doSeg.m @@ -69,8 +69,8 @@ nameInfo_tmp.npos(4,1) = 1; % z value name = MakeFileName(nameInfo_tmp); namePhase = [dirname_xy,'phase',filesep,name]; - phase = intImRead( namePhase ); - + phase = intImLoader( namePhase, CONST ); + if num_z > 1 % if there are z frames phaseCat = zeros( [size(phase), num_z], 'uint16' ); phaseCat(:,:,1) = phase; @@ -78,7 +78,8 @@ for iz = 2:num_z nameInfo_tmp.npos(4,1) = iz; name = MakeFileName(nameInfo_tmp); - phaseCat(:,:,iz) = intImRead( [dirname_xy,'phase',filesep,name] ); + phaseCat(:,:,iz) = intImLoader( ... + [dirname_xy,'phase',filesep,name], CONST ); end phase = mean( phaseCat, 3); end @@ -110,7 +111,8 @@ nameInfo_tmp.npos(2,1) = nc(k); nameInfo_tmp.npos(4,1) = 1; name = MakeFileName( nameInfo_tmp ); - fluor_tmp = intImRead( [dirname_xy,'fluor',num2str(nc(k)-1),filesep,name] ); + fluor_tmp = intImLoader( [dirname_xy,... + 'fluor',num2str(nc(k)-1),filesep,name], CONST ); data.(['fluor',num2str(nc(k)-1)])=fluor_tmp; imRange(:,k) = intRange( fluor_tmp(:) ); @@ -124,4 +126,5 @@ disp([dataname, ' already exists.']); end -end \ No newline at end of file +end + diff --git a/segmentation/intImLoader.m b/segmentation/intImLoader.m new file mode 100644 index 0000000..42438f1 --- /dev/null +++ b/segmentation/intImLoader.m @@ -0,0 +1,16 @@ +function im = intImLoader( imname, CONST ) +%UNTITLED Summary of this function goes here +% Detailed explanation goes here + + tmp_im = intImRead( imname ); + + if isfield( CONST.superSeggerOpti, 'rescale' ) && ... + CONST.superSeggerOpti.rescale ~= 1 + im = imresize( tmp_im, CONST.superSeggerOpti.rescale ); + else + im = tmp_im; + end + + +end + diff --git a/trainingConstants/modifyConstValuesGUI.m b/trainingConstants/modifyConstValuesGUI.m index 759bbe5..b76cb2f 100644 --- a/trainingConstants/modifyConstValuesGUI.m +++ b/trainingConstants/modifyConstValuesGUI.m @@ -209,7 +209,7 @@ function image_folder_ClickedCallback(hObject, eventdata, handles) [imageName,directoryName , ~] = uigetfile('*.tif', 'Pick an image file'); if imageName~=0 handles.directory.String = [directoryName,filesep,imageName]; - settings_mod.phaseImage = imread(handles.directory.String); + settings_mod.phaseImage = intImRead(handles.directory.String); axes(handles.viewport_modify); imshow(settings_mod.phaseImage,[]); end @@ -517,7 +517,7 @@ function run_Callback(hObject, eventdata, handles) if numel(imageName)<3 || ~strcmp(imageName(end-3:end), '.tif') image_folder_ClickedCallback([],[],handles); end -phaseIm = imread(handles.directory.String); +phaseIm = intImRead(handles.directory.String); set(gcf,'Pointer','watch'); settings_mod.data = superSeggerOpti(phaseIm,[],0,CONST); diff --git a/trainingConstants/trainingGui.m b/trainingConstants/trainingGui.m index 897c3eb..5a90316 100644 --- a/trainingConstants/trainingGui.m +++ b/trainingConstants/trainingGui.m @@ -753,7 +753,7 @@ function loadData(frameNumber) settings_train.currentData = load([settings_train.loadDirectory,settings_train.loadFiles(frameNumber).name]); end else - settings_train.currentData = imread([settings_train.imageDirectory,settings_train.loadFiles(frameNumber).name]); + settings_train.currentData = intImRead([settings_train.imageDirectory,settings_train.loadFiles(frameNumber).name]); end settings_train.currentIsBad = strfind(settings_train.loadFiles(frameNumber).name, '_mod.mat'); @@ -865,7 +865,7 @@ function makeData_Callback(hObject, eventdata, handles) cropY = ceil(handles.viewport_train.YLim(1):handles.viewport_train.YLim(2) - 1); for i = 1:settings_train.frameSkip:maxFrames - tempImage = imread([settings_train.imageDirectory,settings_train.loadFiles(i).name]); + tempImage = intImRead([settings_train.imageDirectory,settings_train.loadFiles(i).name]); saveName = [newDir, filesep, settings_train.loadFiles(i).name]; imwrite( tempImage(cropY, cropX), saveName, 'TIFF' ); end @@ -977,7 +977,7 @@ function save_cut_Callback(hObject, eventdata, handles) i = settings_train.frameNumber; filename =[ settings_train.imageDirectory,filesep,settings_train.loadFiles(i).name]; -tempImage = imread([filename]); +tempImage = intImRead([filename]); saveName = [filename]; imwrite( tempImage(cropY, cropX), saveName, 'TIFF' ); diff --git a/viz/fixFlags.m b/viz/fixFlags.m index bd5507c..3007212 100644 --- a/viz/fixFlags.m +++ b/viz/fixFlags.m @@ -133,7 +133,7 @@ % modifies the transparency of the phase/mask - use as double from 0 - 1 if ~isfield(FLAGS, 'level'); - FLAGS.level = 0.8*ones([1,10]); + FLAGS.level = 0.5*ones([1,10]); end % modifies the transparency of the phase/mask - use as double from 0 - 1 diff --git a/viz/superSeggerViewerGui.m b/viz/superSeggerViewerGui.m index 586ff53..c7ea60e 100644 --- a/viz/superSeggerViewerGui.m +++ b/viz/superSeggerViewerGui.m @@ -37,7 +37,7 @@ gui_mainfcn(gui_State, varargin{:}); end -function disable_all_panels (hObject,handles) +function disable_all_panels (~,handles) set(findall(handles.gate_options_text, '-property', 'enable'), 'enable', 'off') set(findall(handles.output_options_text, '-property', 'enable'), 'enable', 'off') set(findall(handles.display_options_text, '-property', 'enable'), 'enable', 'off') @@ -131,6 +131,9 @@ function initImage(hObject, handles) % Not updated handles.num_errs = 0; handles.canUseErr = 0; +axes(handles.axes1); +axis tight +cla; if (nargin<1 || isempty(handles.image_directory.String)) handles.image_directory.String = pwd; @@ -147,8 +150,7 @@ function initImage(hObject, handles) % Not updated file_filter = ''; CONST = []; -axis tight -cla; + dirname = fixDir(dirname); dirname0 = dirname; @@ -238,21 +240,21 @@ function initImage(hObject, handles) % Not updated handles.cell_poles.Value = FLAGS.p_flag; handles.legend_box.Value = FLAGS.legend; handles.outline_cells.Value = FLAGS.Outline_flag; -handles.foci_box.Value = FLAGS.s_flag; -handles.scores_foci.Value = FLAGS.scores_flag; - if FLAGS.f_flag + handles.foci_box.Value = FLAGS.s_flag(FLAGS.f_flag); + handles.scores_foci.Value = FLAGS.scores_flag; handles.filt.Value = FLAGS.filt(FLAGS.f_flag); + handles.phase_flag.Value = FLAGS.phase_flag(FLAGS.f_flag); else handles.filt.Value = 0; end + handles.region_outlines.Value = FLAGS.P_flag; handles.region_scores.Value = FLAGS.regionScores; handles.use_seg_files.Value = FLAGS.useSegs; handles.show_daughters.Value = FLAGS.showDaughters; handles.show_mothers.Value = FLAGS.showMothers; handles.show_linking.Value = FLAGS.showLinks; -handles.phase_flag.Value = FLAGS.phase_flag; handles.phase_level_txt.String = num2str(FLAGS.phase_level); handles.composite.Value = FLAGS.composite; if exist('nn','var');