Skip to content
Snippets Groups Projects
Commit 8bc577c7 authored by Eric Wait's avatar Eric Wait
Browse files

Changed the default image loading to brighten all

parent b42a76b9
No related branches found
No related tags found
No related merge requests found
...@@ -61,7 +61,7 @@ float4 ViewAlignedVolumePS( VS_OUTPUT input ) : SV_TARGET ...@@ -61,7 +61,7 @@ float4 ViewAlignedVolumePS( VS_OUTPUT input ) : SV_TARGET
color.rgb += (lightMod*intensity*channelColor[i].rgb); color.rgb += (lightMod*intensity*channelColor[i].rgb);
unlitComposite += intensity*channelColor[i].rgb; unlitComposite += intensity*channelColor[i].rgb;
alphaComposite += intensity*channelColor[i].rgb*channelColor[i].a; alphaComposite += intensity*channelColor[i].rgb*channelColor[i].a/2.0f;
} }
float maxComponent = max(max(unlitComposite.r,unlitComposite.g),unlitComposite.b); float maxComponent = max(max(unlitComposite.r,unlitComposite.g),unlitComposite.b);
......
...@@ -13,7 +13,7 @@ function AutoTransferFunction(im) ...@@ -13,7 +13,7 @@ function AutoTransferFunction(im)
N = histcounts(curIm(curIm>0),255); N = histcounts(curIm(curIm>0),255);
forwardSum = cumsum(N); forwardSum = cumsum(N);
lowerBound = forwardSum > sum(N)*0.05; lowerBound = forwardSum > sum(N)*0.1;
l = find(lowerBound,1,'first'); l = find(lowerBound,1,'first');
if (isempty(l)) if (isempty(l))
lb(c) = 0; lb(c) = 0;
...@@ -36,7 +36,7 @@ function AutoTransferFunction(im) ...@@ -36,7 +36,7 @@ function AutoTransferFunction(im)
for c=1:size(im,4) for c=1:size(im,4)
channelData(c).minVal = lb(c)/255; channelData(c).minVal = lb(c)/255;
channelData(c).maxVal = ub(c)/255; channelData(c).maxVal = ub(c)/255;
channelData(c).alphaMod = 0.1; channelData(c).alphaMod = 0.5;
end end
D3d.UI.Ctrl.SetUserData(imageData,ucolors,channelData); D3d.UI.Ctrl.SetUserData(imageData,ucolors,channelData);
D3d.UI.Ctrl.UpdateCurrentState(); D3d.UI.Ctrl.UpdateCurrentState();
......
...@@ -61,7 +61,7 @@ float4 ViewAlignedVolumePS( VS_OUTPUT input ) : SV_TARGET ...@@ -61,7 +61,7 @@ float4 ViewAlignedVolumePS( VS_OUTPUT input ) : SV_TARGET
color.rgb += (lightMod*intensity*channelColor[i].rgb); color.rgb += (lightMod*intensity*channelColor[i].rgb);
unlitComposite += intensity*channelColor[i].rgb; unlitComposite += intensity*channelColor[i].rgb;
alphaComposite += intensity*channelColor[i].rgb*channelColor[i].a; alphaComposite += intensity*channelColor[i].rgb*channelColor[i].a/2.0f;
} }
float maxComponent = max(max(unlitComposite.r,unlitComposite.g),unlitComposite.b); float maxComponent = max(max(unlitComposite.r,unlitComposite.g),unlitComposite.b);
......
%LOADIMAGE D3d.LoadImage( im, bufferNum, frameNumber) %LOADIMAGE D3d.LoadImage( im, bufferNum, frameNumber, nonNormalized)
function LoadImage( im, bufferNum, frameNumber ) function im8 = LoadImage( im, bufferNum, frameNumber, dontNormalized )
global D3dIsOpen global D3dIsOpen
if (isempty(D3dIsOpen) || ~D3dIsOpen) if (isempty(D3dIsOpen) || ~D3dIsOpen)
error('You need to open the viewer before you can load images! Call D3d.Open first.'); error('You need to open the viewer before you can load images! Call D3d.Open first.');
...@@ -20,6 +20,10 @@ function LoadImage( im, bufferNum, frameNumber ) ...@@ -20,6 +20,10 @@ function LoadImage( im, bufferNum, frameNumber )
error('You can only load one frame at a time!'); error('You can only load one frame at a time!');
end end
if (~exist('nonNormalized','var') || isempty(dontNormalized))
dontNormalized = false;
end
bufferType = 'original'; bufferType = 'original';
if (bufferNum==2) if (bufferNum==2)
bufferType = 'processed'; bufferType = 'processed';
...@@ -30,7 +34,11 @@ function LoadImage( im, bufferNum, frameNumber ) ...@@ -30,7 +34,11 @@ function LoadImage( im, bufferNum, frameNumber )
im = permute(im,[1,2,5,4,3]); im = permute(im,[1,2,5,4,3]);
end end
im8 = ImUtils.ConvertType(im,'uint8',true); if (dontNormalized)
im8 = ImUtils.ConvertType(im,'uint8');
else
im8 = ImUtils.BrightenImages(im,'uint8');
end
if (isempty(frameNumber)) if (isempty(frameNumber))
D3d.Viewer.LoadTexture(im8,bufferType); D3d.Viewer.LoadTexture(im8,bufferType);
else else
......
...@@ -81,7 +81,7 @@ function [varargout] = Open( im, imData, imagePath, mesagePkgStr ) ...@@ -81,7 +81,7 @@ function [varargout] = Open( im, imData, imagePath, mesagePkgStr )
%% open the region chooser if the image is too big %% open the region chooser if the image is too big
if (any(imData.Dimensions>2048)) if (any(imData.Dimensions>2048))
D3d.UI.InitializeMipFigure(im,imData,imData.imageDir,true); D3d.UI.InitializeMipFigure(im,imData);
if (nargout>1) if (nargout>1)
varargout{2} = []; varargout{2} = [];
end end
...@@ -107,17 +107,17 @@ function [varargout] = Open( im, imData, imagePath, mesagePkgStr ) ...@@ -107,17 +107,17 @@ function [varargout] = Open( im, imData, imagePath, mesagePkgStr )
end end
if (size(im,5)<imData.NumberOfFrames) if (size(im,5)<imData.NumberOfFrames)
D3d.LoadImage(im(:,:,:,:,1),1,1); im8 = D3d.LoadImage(im(:,:,:,:,1),1,1);
D3d.Update(); D3d.Update();
loadTransFunc(imData,im); loadTransFunc(imData,im8);
for t=2:size(im,5) for t=2:size(im,5)
D3d.LoadImage(im(:,:,:,:,t),1,t); D3d.LoadImage(im(:,:,:,:,t),1,t);
end end
else else
for t=1:size(im,5) for t=1:size(im,5)
D3d.LoadImage(im(:,:,:,:,t),1,t); im8 = D3d.LoadImage(im(:,:,:,:,t),1,t);
end end
loadTransFunc(imData,im); loadTransFunc(imData,im8);
D3d.Update(); D3d.Update();
end end
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment