Skip to content
Snippets Groups Projects
Commit 7627e448 authored by ac's avatar ac
Browse files

ignore tif mat darkTubes render pipeline

parent 84041912
No related branches found
No related tags found
No related merge requests found
......@@ -3,3 +3,7 @@ src/MATLAB/clusterExamples/*.mat
*.xlsx
*.rtf
*.asv
*.mat
*.tif
*.tiff
......@@ -11,7 +11,7 @@ cudaTarget = getCudaTarget;
if thicknessIn < 0
% bright plate
sigmaPlate = [8,0.5,8]; %[1,10,1].*sigma;
sigmaPlate = [8,0.25,8]; %[1,10,1].*sigma;
imfPlate = HIP.LoG(im,sigmaPlate,cudaTarget);
imnPlate = imfPlate;
imnPlate(imnPlate>0) = 0;
......
......@@ -13,10 +13,8 @@ end
im = uint8(im); % values are already uint8, just wrapped in a double
AX = 1/sqrt(3);
sx = AX .* radii;
cudaTarget = getCudaTarget;
imf = HIP.LoG(im,sx,cudaTarget);
[~,imp,imn] = LoG.separateLoG(imf);
[~,imp,imn] = RSF.LoG(im,radii);
imn = imn .* imregionalmax(imn);
imp = imp .* imregionalmax(imp);
......
tic
path(path,fullfile('../clusterExamples/'))
ROOT = '/g/leverjs/Schuman_OCT/OCT/nonHumanPrimate';
fname = fullfile(ROOT,'31344_OS_V_5x5_0_0004257.LEVER');
[imraw,CONSTANTS] = leversc.loadImage(fname,1,2);
% ROOT = '/g/leverjs/Schuman_OCT/OCT/nonHumanPrimate';
% fname = fullfile(ROOT,'31344_OS_V_5x5_0_0004257.LEVER');
fname = '/g/leverjs/Schuman_OCT/OCT/qualifiedYes/P10010_Optic Disc Cube 200x200_10-4-2017_10-17-5_OD_sn0989_cube_raw.LEVER'
[imraw,CONSTANTS] = leversc.loadImage(fname,1,2); % noised on ch 2
% imraw = flip(permute(imraw,[2,1]),2); % ACK verify direction!
rx = 5;
im_medfilt = medfilt3(imraw,[3,5,5]); % experimental denoise
% note NLM takes minutes (vs. e.g. seconds for LoG etc)...use batch!
cudaTarget = getCudaTarget;
im = HIP.NLMeans(im_medfilt,0.1,12,1,cudaTarget);
% % note NLM takes minutes (vs. e.g. seconds for LoG etc)...use batch!
% im_medfilt = medfilt3(imraw,[3,5,5]); % experimental denoise
% cudaTarget = getCudaTarget;
% im_nlm = HIP.NLMeans(im_medfilt,0.1,12,1,cudaTarget);
im = leversc.loadImage(fname,1,1); % image on channel 1
thickness = 5;
voxelSize = CONSTANTS.imageData.PixelPhysicalSize;
......@@ -22,80 +26,19 @@ cudaTarget = getCudaTarget;
imf = HIP.LoG(im,sigma,cudaTarget);
imp=imf;imp(imp<0)=0;
imfm = fibermetric(imp); % dark tubes
imfmX = imfm .* imregionalmax(imfm);
imn = imf;
imn(imn>0)=0;imn=abs(imn);
sigmaPlate = [1,5,1].*sigma;
imfPlate = HIP.LoG(imn,sigmaPlate,cudaTarget);
imnPlate = imfPlate;
imnPlate(imnPlate>0) = 0;
imnPlate = abs(imnPlate);
imnPlate = mat2gray(imnPlate);
voxelSize = CONSTANTS.imageData.PixelPhysicalSize;
voxelSize([1,2]) = voxelSize([2,1]); % swap (x,y,z) to matlab column major (y,x,z)
vx = max(voxelSize)./voxelSize;
sigma = 1/sqrt(3) * thickness./2 * vx;
cudaTarget = getCudaTarget;
imf = HIP.LoG(im,sigma,cudaTarget);
imn = imf;
imn(imn>0) = 0;
imn = abs(imn);
imp=imf;imp(imp<0)=0;
imfm = fibermetric((imp));
outfile = 'nhp_metricEmbeddings.tif';
%
imfmX = imfm.*imregionalmax(imfm);
% bright plate
sigmaPlate = [1,5,1].*sigma;
% sigmaPlate = [1,5,1].*sigma;
sigmaPlate = [5,0.25,5];
imfPlate = HIP.LoG(im,sigmaPlate,cudaTarget);
imnPlate = imfPlate;
imnPlate(imnPlate>0) = 0;
imnPlate = abs(imnPlate);
imnPlateX = imnPlate.*imregionalmax(imnPlate,6);
imnPlateX = mat2gray(imnPlateX);
% impPlate = imfPlate;
% impPlate(imnPlate<0) = 0;
% impPlateX = impPlate.*imregionalmax(imnPlate,6);
sliceThickness = 10;
bClear = true;
for Z = 100: 1 :size(im,1)-100
clipLimits=[];
clipLimits.dim = 1;
clipLimits.range = [Z-sliceThickness:Z+sliceThickness];
clipLimits.range(clipLimits.range>size(im,1))=[];
clipLimits.range(clipLimits.range<1)=[];
im1 = getClipFrame(im,clipLimits,gray());
im2 = getClipFrame(imn,clipLimits);
im3 = getClipFrame(imp,clipLimits);
im4 = getClipFrame(imfm,clipLimits);
im6 = getClipFrame(imraw,clipLimits,gray());
% im7 = getClipFrame(imfmX,clipLimits);
im7 = getClipFrame(imnPlateX,clipLimits);
im7 = imdilate(im7,strel('disk',3));
im8 = getClipFrame(imnPlate,clipLimits);
impPlate = imfPlate;
impPlate(impPlate<0)=0;
imOut = [ im6,im2, im8 ; im3, im4, im7 ];
clf;imagesc(imOut);
title(num2str(Z))
drawnow
if bClear
imwrite(imOut,outfile);
bClear = false;
else
imwrite(imOut,outfile,'writemode','append');
end
end
toc
\ No newline at end of file
% Next run renderPipeline to draw...
\ No newline at end of file
outfile = 'humanDarkTube.tif';
sliceThickness = 1024;
bClear = true;
sz = max(size(im));
for Z = 1 : 1 : size(im,1)
clipLimits=[];
clipLimits.dim = 1;
clipLimits.range = [1:1024]; %[Z-sliceThickness:Z+sliceThickness];
clipLimits.range(clipLimits.range>size(im,1))=[];
clipLimits.range(clipLimits.range<1)=[];
imPipeline = [...
getClipFrame(imraw,clipLimits,gray())...
getClipFrame(imn,clipLimits),...
getClipFrame(imp,clipLimits),...
getClipFrame(imnPlate,clipLimits),...
getClipFrame(imfmX,clipLimits),...
];
for idim = 2:3
z2 = mod(Z,size(im,idim));
clipLimits.dim = idim;
clipLimits.range = [1:size(im,idim)];%z2;
imPipeline = [imPipeline;...
getClipFrame(imraw,clipLimits,gray()),...
getClipFrame(imn,clipLimits),...
getClipFrame(imp,clipLimits),...
getClipFrame(imnPlate,clipLimits),...
getClipFrame(imfmX,clipLimits),...
];
end
% MIP rendered pipeline at narrow aspect ratio for eg 8.5x11 paper
imPipeline = permute(imPipeline,[2,1,3]);
clf;imagesc(imPipeline);drawnow
title(num2str(Z))
drawnow
if 1
if bClear
imwrite(imPipeline,outfile);
bClear = false;
else
imwrite(imPipeline,outfile,'writemode','append');
end
end
fout= dir(outfile);
if fout.bytes > 1e9
if ~exist('ox','var')
ox = outfile;
nOutfile = 1;
end
nOutfile = nOutfile+1;
outfile = [num2str(nOutfile) '_' ox];
bClear = true;
end
end
\ No newline at end of file
outfile = 'humanDarkTube.tif';
sliceThickness = 1;
bClear = true;
sz = max(size(im));
STRIDE = min(size(im));
for Z = 1 : 1 : size(im,1)
clipLimits=[];
clipLimits.dim = 1;
clipLimits.range = [Z-sliceThickness:Z+sliceThickness];
clipLimits.range(clipLimits.range>size(im,1))=[];
clipLimits.range(clipLimits.range<1)=[];
imPipeline = [...
getClipFrame(imraw,clipLimits,gray()),...
getClipFrame(imn,clipLimits),...
getClipFrame(imp,clipLimits),...
getClipFrame(imnPlate,clipLimits),...
getClipFrame(imfmX,clipLimits),...
];
for idim = 2:3
z2 = mod(Z,size(im,idim));
clipLimits.dim = idim;
clipLimits.range = z2;
imPipeline = [imPipeline;...
getClipFrame(imraw,clipLimits,gray()),...
getClipFrame(imn,clipLimits),...
getClipFrame(imp,clipLimits),...
getClipFrame(imnPlate,clipLimits),...
getClipFrame(imfmX,clipLimits),...
];
end
clf;imagesc(imPipeline);drawnow
title(num2str(Z))
drawnow
if 1
if bClear
imwrite(imPipeline,outfile);
bClear = false;
else
imwrite(imPipeline,outfile,'writemode','append');
end
end
fout= dir(outfile);
if fout.bytes > 1e9
if ~exist('ox','var')
ox = outfile;
nOutfile = 1;
end
nOutfile = nOutfile+1;
outfile = [num2str(nOutfile) '_' ox];
bClear = true;
end
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment