Skip to content
Snippets Groups Projects
Commit ccfad843 authored by Loic Marx's avatar Loic Marx
Browse files

fixing conflict

parents ddc6cc43 181fd59b
No related branches found
No related tags found
2 merge requests!3Regular merge of develop,!2Seeg algorithm
% PCA
%CT_post = NiftiMod('Seeg_chinese_1_before_final.nii');
CT_post = NiftiMod('seeg_electrode_additional_tryout_high_threshold_2.nii.gz');
<<<<<<< HEAD
=======
CT_post = NiftiMod('Seeg_chinese_1_before_final.nii');
%CT_post = NiftiMod('seeg_seg_bul_inside_binary.nii');
>>>>>>> 181fd59b46f6619677749644bafbb102e57441d2
%% CONSTANTS
% for the contact region (from the paper)
% contact region areas have defined interval of voxels, because they are the smallest parts in the data
MINVOXELNUMBER_CONTACTS = 4; % at least 4 as minimum value
MAXVOXELNUMBER_CONTACTS = 50;
MAXVOXELNUMBER_CONTACTS = 150;
% for head
% bolt head areas have defined minimum of voxels, as they are bigger than contact regions
% a maximum is also defined, as there are sometimes cable artifacts left in the data, so the heads are not the
% biggest areas in the data
MINVOXELNUMBER_HEAD = 51;
MAXVOXELNUMBER_HEAD = 300;
MINVOXELNUMBER_HEAD = 200;
MAXVOXELNUMBER_HEAD = 2000;
%% TODO: find some solution for electrodes, where the contacts regions are "melted" together and no seperate
%% regions and head are defined
%% TODO: find solution for thresholds of heads and contacts, because they're different for every data set
%% get nifti img to binary img, so we can apply some functions
maskedImg = CT_post.img;
......@@ -73,11 +80,11 @@ for i = 1:(length(headCandidate))
% vector of the centroid of the current head candidate
for j = 1:(length(contactCandidate))
centroidPositionContact = ccProps(componentIdxsContacts(j)).Centroid;
newContactPosition = coeff * centroidPositionContact' + centroidPositionHead';
%newContactPosition = coeff * centroidPositionContact' + centroidPositionHead';
disp(['new Contact Position at ' num2str(j) ' is: ' num2str(newContactPosition')]);
%disp(['new Contact Position at ' num2str(j) ' is: ' num2str(newContactPosition')]);
newPositionsContactCandidates(:,j) = newContactPosition;
newPositionsContactCandidates(:,j) = centroidPositionContact';
end
% just for plotting purposes
......@@ -127,27 +134,27 @@ for i = 1:(length(headCandidate))
% with the contact candidates
baseline = @(t)(originOfLine + originToSecondPoint * t);
concreteCandidatesForElectrode = zeros(3,:);
% concreteCandidatesForElectrode = zeros(3,:);
% iterate through all contact candidates to find all of them, that have a smaller distance to the baseline
% than some defined threshold
% TODO: sort out possible problems with voxels/mm between line and point
for k = 1:(length(contactCandidate))
% max dist between contact candidate and baseline, to actually consider it for the electrode
maxAllowedDist = 5;
% max length of electrode, cutting every eletrode beyond that
thresholdElecMaxValue = baseline(10);
xValueOfThreshold = thresholdElecMaxValue(1,:);
% get a candidate from the contacts and the x-Value to compare it to the baseline
contactPoint = newPositionsContactCandidates(:,k);
xValueOfContactPoint = contactPoint(1,:);
if(xValueOfContactPoint <= xValueOfThreshold)
concreteCandidatesForElectrode(:,k) = contactPoint;
end
% for k = 1:(length(contactCandidate))
%
% % max dist between contact candidate and baseline, to actually consider it for the electrode
% maxAllowedDist = 5;
%
% % max length of electrode, cutting every eletrode beyond that
thresholdElecMaxValue = baseline(50);
% xValueOfThreshold = thresholdElecMaxValue(1,:);
%
% % get a candidate from the contacts and the x-Value to compare it to the baseline
% contactPoint = newPositionsContactCandidates(:,k);
% xValueOfContactPoint = contactPoint(1,:);
%
% if(xValueOfContactPoint <= xValueOfThreshold)
% concreteCandidatesForElectrode(:,k) = contactPoint;
% end
% wanted to compute distance between point and corresponding point
......@@ -160,17 +167,22 @@ for i = 1:(length(headCandidate))
% if(dist < threshold)
% %add point to matrix
% end
end
%end
%
%
% figure
% plotv(baseline);
figure
figure
axis([0 500 0 500 0 500])
axis equal
scatterMatrix3(newPositionsContactCandidates);
hold on
scatterMatrix3(centroidOfAllContacts');
scatterMatrix3(thresholdElecMaxValue');
scatterMatrix3(thresholdElecMaxValue', {}, '*');
scatterMatrix3(endOneOfBoltHead');
scatterMatrix3(endTwoOfBoltHead');
% hold off
......@@ -193,7 +205,7 @@ for i = 1:(length(headCandidate))
% te=det(newcoeff);
end
scatterMatrix3(newHeadPositions);
scatterMatrix3(newHeadPositions');
hold off
% figure
......@@ -201,34 +213,4 @@ hold off
% X = ccProps(componentIdxs(i)).PixelList .* repmat(CT_post.voxsize', length(ccProps(componentIdxs(i)).PixelList) ,1);
% scatterMatrix3(X)
% hold on
% end
%
% x=coeff(:,1);
% y=coeff(:,2);
% z=coeff(:,3);
%
% inter = intersect(intersect(x,y),z);
%
% plot(x);
% plot(y);
% plot(z);
%
% t=det(coeff);
%
% plot3(x,y,z);
%
% %coeff(:,1)
%
%
% M = [0,0,1;0,0,-1;0,1,0];
%
% a = M(:,1);
% b = M(:,2);
% c = M(:,3);
%
% vec_inter = intersect(intersect(a,b), c);
%
% figure;
% plotv(M, '-');
% end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment