Commit c0cb9dc4 authored by Johannes Maul's avatar Johannes Maul
Browse files

Wrapper for mex-call.

Wrapper does exp and log for attenuation values because matlab can do dopple precision. For very high distancences needed.
parent 1273dc0e
No preview for this file type
function [attenuationValues, attenuationPicture] = attenuationCalculationWrapper (detectorPositionCoordinates, faces, nodes, source, detectorSizeUint,attenuationCoefficentValues, photons)
[attenuationValues, ~] = nv_ray_tracing_basic(detectorPositionCoordinates, faces, nodes, source, detectorSizeUint,attenuationCoefficentValues); %parameters always in this order
attenuationValues = exp(attenuationValues * photons);%for correctnes of Beer-Lambert-Law % EXP and LOG not on GPU because GLSL just offers single precision. Same Example'll lose details.
attenuationValues = -log(attenuationValues);%For better image vision
attenuationPicture = reshape(attenuationValues,detectorSizeUint);
%times = reformatProfile(profiling);
%debugMissFormated = reshape(debugMiss,[200 detectorSizeUint(1) detectorSizeUint(2)]);
end
\ No newline at end of file
......@@ -24,16 +24,16 @@ function easyExample(exampleType, buildDefault)
testVolume = ones(testVolumeSize)+2;
isoValues = [1];
source = [testVolumeSize(2)/2 testVolumeSize(1)/2 testVolumeSize(3)*1000];%centered above the test volume
attenuationCoefficentValues = [ -0.3403, -0.1500, -0.3783];%1 = gland, 2=fat,3=muscle
attenuationCoefficentValues = [ -0.3403, -0.1500, -0.3783];%1 = gland, 2=fat,3=muscle %K. Bliznakova et al. "A three-dimensional breast software phantom for mammography simulation" , 2003, Phys. Med. Biol., 48, 3699
end
if exampleType == "easy"
testVolumeSize = [100 120 50];
testVolume = ones(testVolumeSize)+1;
testVolume(10:90,10:90,10:40) = 1;
testVolume = ones(testVolumeSize);
testVolume(10:90,10:90,10:40) = 2;
testVolume(30:70,30:70,15:35) =3;
isoValues = [0.5,1.5,2.5];
source = [testVolumeSize(2)/2 testVolumeSize(1)/2 testVolumeSize(3)*10];%centered above the test volume
attenuationCoefficentValues = [0.15,0.34 , 0.38];%1 = gland, 2=fat,3=muscle
attenuationCoefficentValues = [-0.372, -0.25, -0.38];%1 = gland, 2=fat,3=muscle %K. Bliznakova et al. "A three-dimensional breast software phantom for mammography simulation" , 2003, Phys. Med. Biol., 48, 3699
end
[nodes,~,faces] = vol2mesh(uint8(testVolume),1:testVolumeSize(1),1:testVolumeSize(2),1:testVolumeSize(3),1.5,1.5,1,'cgalmesh',isoValues);
......@@ -42,13 +42,9 @@ function easyExample(exampleType, buildDefault)
% nodes(:,1:2) = nodes(:,1:2) +10;
end
tic;
[projection, profiling] = nv_ray_tracing_basic(detectorPositionCoordinates, faces, nodes, source, detectorSizeUint,attenuationCoefficentValues' ); %parameters always in this order
[~, attenuationPicture] = attenuationCalculationWrapper(detectorPositionCoordinates, faces, nodes, source, detectorSizeUint,attenuationCoefficentValues,1);%photons = 1 => relativ Image, just Attenuation
toc;
times = reformatProfile(profiling);
% debugMissFormated = reshape(debugMiss,[200 detectorSizeUint(1) detectorSizeUint(2)]);
projectionAsImage = reshape(projection,detectorSizeUint);
figure; imagesc(-projectionAsImage); axis image; colormap('gray');
figure; imagesc(attenuationPicture); axis image; colormap('gray');
end
function [sizeX, sizeY, detectorPositions] = createOwnExample(exampleType)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment