-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merged the dev_newInfo branch with master
- Loading branch information
Showing
50 changed files
with
3,024 additions
and
884 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
function CONST = intFixFields( CONST, CONST0 ) | ||
% This function adds fields that exist in CONST0 but do not exist in CONST | ||
% to CONST | ||
if isstruct( CONST0 ) | ||
C0n = fieldnames( CONST0 ); | ||
|
||
for ii = 1:numel( C0n ) | ||
|
||
if isfield( CONST, C0n{ii} ) | ||
CONST = setfield( CONST, C0n{ii}, ... | ||
intFixFields( getfield( CONST, C0n{ii} ),... | ||
getfield( CONST0, C0n{ii}) ) ); | ||
else | ||
CONST = setfield( CONST, C0n{ii}, getfield( CONST0, C0n{ii})); | ||
end | ||
|
||
end | ||
%else | ||
% CONST = CONST0; | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
function name_mod = intFixFileName( name, str_end) | ||
% Fixes a file name by adding the suffix str_end if it doesn't already | ||
% exist | ||
if str_end(1) ~= '.' | ||
str_end = ['.',str_end]; | ||
end | ||
|
||
ns = numel( str_end ); | ||
nn = numel( name ); | ||
|
||
% check file name length | ||
if ns > nn | ||
name_mod = [ name, str_end]; | ||
elseif ~strcmp( name( [end-ns+1:end] ), str_end ) | ||
name_mod = [ name, str_end]; | ||
else | ||
name_mod = [ name ]; | ||
end | ||
|
||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
function nnc = intGetChannelNum( data ) | ||
%% comp number of fluor channels | ||
|
||
nc = numel(find(~cellfun('isempty',strfind(fieldnames(data),'fluor')))); | ||
nnc = 0; | ||
|
||
for jj = 1:nc | ||
|
||
fluorName = ['fluor',num2str(jj)]; | ||
|
||
if isfield( data, fluorName ) | ||
nnc = nnc + 1; | ||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
function im = intImRead(out_name) | ||
% More flexible method for loading images... if the file is a mat file, it | ||
% will load the image in that... else it uses imread | ||
im = []; | ||
|
||
if numel(out_name) > 4 | ||
if strcmp(out_name([end-3:end]), '.mat' ) | ||
tmp = load( out_name ); | ||
if isfield( tmp, 'im' ); | ||
im = tmp.im; | ||
end | ||
elseif strcmp(out_name([end-3:end]), '.tif' ) | ||
im = imread( out_name ); | ||
end | ||
end | ||
|
||
|
||
if numel(size(im)) > 2 | ||
disp('Images are in color - attempting to convert to monochromatic.'); | ||
im = convertToMonochromatic(im); | ||
end | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
function intImWrite(im,out_name) | ||
% More flexible metho of writing images. Can use save if the image name is | ||
% .mat. | ||
if numel( out_name ) > 4 | ||
if strcmp( out_name(end-3:end), '.mat' ) | ||
out_name = intFixFileName( out_name, '.mat' ); | ||
save( out_name, 'im' ); | ||
else | ||
out_name = intFixFileName( out_name, '.tif' ); | ||
imwrite(uint16(im), out_name ,'tif','Compression', 'none'); | ||
end | ||
|
||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
function minmax = intMakeMinMax( im ) | ||
minner = medfilt2( im, [2,2], 'symmetric' ); | ||
maxxer = max( minner(:)); | ||
minner = min( minner(:)); | ||
minmax = [minner,maxxer]; | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
function ranger = intRange( im, CDFr ) | ||
% put max and min in range | ||
|
||
ranger = [min( im ),max( im )]; | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
function imOut = intShiftIm( imIn, out ) | ||
%% intShiftIm: shifts image 'imIn' by the parameters in 'out' | ||
% out is produced by intAlignIm( imA, imB, precision ). | ||
% | ||
% INPUT : | ||
% imIn : input image | ||
% out : output of intAlignIm, | ||
% where the 3rd element is the row_shift and 4th and col_shift | ||
% | ||
% OUTPUT : | ||
% imOut : shifted image | ||
% | ||
% Copyright (C) 2016 Wiggins Lab | ||
% Written by Paul Wiggins. | ||
% University of Washington, 2016 | ||
% This file is part of SuperSegger. | ||
% | ||
% SuperSegger is free software: you can redistribute it and/or modify | ||
% it under the terms of the GNU General Public License as published by | ||
% the Free Software Foundation, either version 3 of the License, or | ||
% (at your option) any later version. | ||
% | ||
% SuperSegger is distributed in the hope that it will be useful, | ||
% but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
% GNU General Public License for more details. | ||
% | ||
% You should have received a copy of the GNU General Public License | ||
% along with SuperSegger. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
% | ||
% fftB = fft2(imIn); % fourier transform | ||
% | ||
% deltar = out(3); % net_row_shift in subpixel | ||
% deltac = out(4); % net_col_shift in subpixel | ||
% | ||
% phase = 0; | ||
% [nr,nc] = size(imIn); % nr : num of rows, nc : num of columns | ||
% Nr = ifftshift(-fix(nr/2):ceil(nr/2)-1); % swaps the left and right halves | ||
% Nc = ifftshift(-fix(nc/2):ceil(nc/2)-1); | ||
% [Nc,Nr] = meshgrid(Nc,Nr); | ||
% | ||
% fftB = fftB.*exp(1i*2*pi*(deltar*Nr/nr+deltac*Nc/nc)); | ||
% | ||
% imOut = (real(ifft2(fftB).*exp(-1i*phase))); | ||
% | ||
% This re-implementation uses the matlab built in imtranslate. | ||
|
||
|
||
imOut = imtranslate( imIn, -out([4,3]),'FillValues', mean(imIn(:))); | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.