Commit 53a49fdd authored by Johannes Maul's avatar Johannes Maul
Browse files

New Example with analytical accuracy detection. Two examples are possible.

Value for one Layer example: -5
Value for two Layer excample: -7
parent 922a9f22
function [nodes, faces,source,detectorPositionCoordinates,detectorSizeUint,attenuationCoefficentValues] = analyticalExample (materials)
nodes = [8,8,4;
12,8,4;
12,12,4;
8,8,5;
12,8,5;
12,12,5;
8,8,7;
12,8,7;
12,12,7;
8,8,9;
12,8,9;
12,12,9;];
if materials == "one"
faces = [1,2,3,1;
10,11,12,1;];
elseif materials == "two"
faces = [1,2,3,1;
4,5,6,1;
4,5,6,2;
7,8,9,2;
7,8,9,1;
10,11,12,1;];
end
source = [10,9,0];
detectorPositionCoordinates =[10,9,10];
detectorSizeUint = uint32([1 1]);
attenuationCoefficentValues = [1,2];
end
\ No newline at end of file
......@@ -22,6 +22,10 @@ function [times] = easyExample(exampleType, buildDefault)
Disp("exampleReal.mat not found, try another example");
return;
end
elseif exampleType == "analyticalOne"
[nodes, faces,source,detectorPositionCoordinates,detectorSizeUint,attenuationCoefficentValues] = analyticalExample ("one");
elseif exampleType == "analyticalTwo"
[nodes, faces,source,detectorPositionCoordinates,detectorSizeUint,attenuationCoefficentValues] = analyticalExample ("two");
else %else is just running if exampleFiles are missing. But the iso2mesh files are required. See Doku.
[detectorSizeX, detectorSizeY, detectorPositionCoordinates] = createOwnExample(exampleType);
detectorSizeUint = uint32([detectorSizeX detectorSizeY]);
......@@ -41,8 +45,7 @@ function [times] = easyExample(exampleType, buildDefault)
isoValues = [0.5,1.5,2.5];
source = [testVolumeSize(2)/2 testVolumeSize(1)/2 testVolumeSize(3)*10];%centered above the test volume
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
end
[nodes,~,faces] = vol2mesh(uint8(testVolume),1:testVolumeSize(1),1:testVolumeSize(2),1:testVolumeSize(3),1.5,1.5,1,'cgalmesh',isoValues); %just usable with iso2mesh repo! http://iso2mesh.sourceforge.net/cgi-bin/index.cgi
faces = unique(faces,'rows'); %special for vol2mesh were the outer layer got an air layer which destroys the calculation
......@@ -50,7 +53,7 @@ function [times] = easyExample(exampleType, buildDefault)
tic;
[~, attenuationPicture, times] = attenuationCalculationWrapper(detectorPositionCoordinates, faces, nodes, source, detectorSizeUint,attenuationCoefficentValues,1);%photons = 1 => relativ Image, just Attenuation
toc;
%figure; imagesc(attenuationPicture); axis image; colormap('gray'); title(exampleType);
figure; imagesc(attenuationPicture); axis image; colormap('gray'); title(exampleType);
end
function [sizeX, sizeY, detectorPositions] = createOwnExample(exampleType)
......
......@@ -155,6 +155,7 @@ void main()
// debug.values[rayPayload.outputId+debugCounter] = finalFaces[i]-1;
// debugCounter++;
attenuationValue += length((finalDistances[i] - finalDistances[i+1]) *rayDir) * attCoefDyn.values[finalFaces[i]-1];
// attenuationValue += length((finalDistances[i] - finalDistances[i+1])) * attCoefDyn.values[finalFaces[i]-1];
// debug.values[rayPayload.outputId+debugCounter] = attenuationValue;
// debugCounter++;
//debug.values[rayPayload.outputId+i] = length((finalDistances[i] - finalDistances[i+1]) * rayDir) * attCoef.attCoefVal[finalFaces[i]-1];
......
......@@ -76,6 +76,7 @@ void main()
uint rayFlags = gl_RayFlagsSkipClosestHitShaderNV | gl_RayFlagsNoOpaqueNV;
uint cullMask = 0xff;
float tmin = 0;
// direction.xyz = normalize(direction.xyz)
float tmax = 1.0;
traceNV(topLevelAS, rayFlags, cullMask, 0, 0, 0, origin.xyz, tmin, direction.xyz, tmax, 0);
......
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