diff --git a/src/c/Shaders/ViewAlignedVolumePS.hlsl b/src/c/Shaders/ViewAlignedVolumePS.hlsl index 8d78f9528c19db7e3d43ba0ec6f3f87337d5a003..925016d8713af57e886e23c3e7df4a2085d2d480 100644 --- a/src/c/Shaders/ViewAlignedVolumePS.hlsl +++ b/src/c/Shaders/ViewAlignedVolumePS.hlsl @@ -61,7 +61,7 @@ float4 ViewAlignedVolumePS( VS_OUTPUT input ) : SV_TARGET color.rgb += (lightMod*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); diff --git a/src/matlab/+D3d/+UI/AutoTransferFunction.m b/src/matlab/+D3d/+UI/AutoTransferFunction.m index c4f3afc3d6f5dcbfafb975389ad9cc0ed99a9d2b..b52eb8c18fc33bfa2a2f42dc9bdadb4e7be85271 100644 --- a/src/matlab/+D3d/+UI/AutoTransferFunction.m +++ b/src/matlab/+D3d/+UI/AutoTransferFunction.m @@ -13,7 +13,7 @@ function AutoTransferFunction(im) N = histcounts(curIm(curIm>0),255); forwardSum = cumsum(N); - lowerBound = forwardSum > sum(N)*0.05; + lowerBound = forwardSum > sum(N)*0.1; l = find(lowerBound,1,'first'); if (isempty(l)) lb(c) = 0; @@ -36,7 +36,7 @@ function AutoTransferFunction(im) for c=1:size(im,4) channelData(c).minVal = lb(c)/255; channelData(c).maxVal = ub(c)/255; - channelData(c).alphaMod = 0.1; + channelData(c).alphaMod = 0.5; end D3d.UI.Ctrl.SetUserData(imageData,ucolors,channelData); D3d.UI.Ctrl.UpdateCurrentState(); diff --git a/src/matlab/+D3d/@Viewer/Shaders/ViewAlignedVolumePS.hlsl b/src/matlab/+D3d/@Viewer/Shaders/ViewAlignedVolumePS.hlsl index 8d78f9528c19db7e3d43ba0ec6f3f87337d5a003..925016d8713af57e886e23c3e7df4a2085d2d480 100644 --- a/src/matlab/+D3d/@Viewer/Shaders/ViewAlignedVolumePS.hlsl +++ b/src/matlab/+D3d/@Viewer/Shaders/ViewAlignedVolumePS.hlsl @@ -61,7 +61,7 @@ float4 ViewAlignedVolumePS( VS_OUTPUT input ) : SV_TARGET color.rgb += (lightMod*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); diff --git a/src/matlab/+D3d/LoadImage.m b/src/matlab/+D3d/LoadImage.m index faa0c857b4e9f0a2ed7b300ad8ffda2306bae920..d4befc0265a393df3afc16c0242e45ab4e2ed0be 100644 --- a/src/matlab/+D3d/LoadImage.m +++ b/src/matlab/+D3d/LoadImage.m @@ -1,6 +1,6 @@ -%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 if (isempty(D3dIsOpen) || ~D3dIsOpen) error('You need to open the viewer before you can load images! Call D3d.Open first.'); @@ -19,6 +19,10 @@ function LoadImage( im, bufferNum, frameNumber ) elseif (numel(frameNumber)>1) error('You can only load one frame at a time!'); end + + if (~exist('nonNormalized','var') || isempty(dontNormalized)) + dontNormalized = false; + end bufferType = 'original'; if (bufferNum==2) @@ -30,7 +34,11 @@ function LoadImage( im, bufferNum, frameNumber ) im = permute(im,[1,2,5,4,3]); end - im8 = ImUtils.ConvertType(im,'uint8',true); + if (dontNormalized) + im8 = ImUtils.ConvertType(im,'uint8'); + else + im8 = ImUtils.BrightenImages(im,'uint8'); + end if (isempty(frameNumber)) D3d.Viewer.LoadTexture(im8,bufferType); else diff --git a/src/matlab/+D3d/Open.m b/src/matlab/+D3d/Open.m index 3231416529b02ede864aba6817364b9c52942f38..97afa75b54dde498bd432339daa5bf309a07a0f2 100644 --- a/src/matlab/+D3d/Open.m +++ b/src/matlab/+D3d/Open.m @@ -81,7 +81,7 @@ function [varargout] = Open( im, imData, imagePath, mesagePkgStr ) %% open the region chooser if the image is too big if (any(imData.Dimensions>2048)) - D3d.UI.InitializeMipFigure(im,imData,imData.imageDir,true); + D3d.UI.InitializeMipFigure(im,imData); if (nargout>1) varargout{2} = []; end @@ -107,17 +107,17 @@ function [varargout] = Open( im, imData, imagePath, mesagePkgStr ) end if (size(im,5)<imData.NumberOfFrames) - D3d.LoadImage(im(:,:,:,:,1),1,1); + im8 = D3d.LoadImage(im(:,:,:,:,1),1,1); D3d.Update(); - loadTransFunc(imData,im); + loadTransFunc(imData,im8); for t=2:size(im,5) D3d.LoadImage(im(:,:,:,:,t),1,t); end else for t=1:size(im,5) - D3d.LoadImage(im(:,:,:,:,t),1,t); + im8 = D3d.LoadImage(im(:,:,:,:,t),1,t); end - loadTransFunc(imData,im); + loadTransFunc(imData,im8); D3d.Update(); end else