Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
seeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
R3
students
seeg
Commits
ccfad843
Commit
ccfad843
authored
5 years ago
by
Loic Marx
Browse files
Options
Downloads
Plain Diff
fixing conflict
parents
ddc6cc43
181fd59b
No related branches found
No related tags found
2 merge requests
!3
Regular merge of develop
,
!2
Seeg algorithm
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sEEG_Segmentation_Script.m
+41
-59
41 additions, 59 deletions
sEEG_Segmentation_Script.m
with
41 additions
and
59 deletions
sEEG_Segmentation_Script.m
+
41
−
59
View file @
ccfad843
% 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');
>>>>>>>
181
fd59b46f6619677749644bafbb102e57441d2
%% 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
=
1
50
;
% 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
=
3
00
;
MINVOXELNUMBER_HEAD
=
200
;
MAXVOXELNUMBER_HEAD
=
20
00
;
%% 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
(
1
0
);
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
(
5
0
);
%
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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment