Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Eamon Doyle
roiTool
Commits
5c89546d
Commit
5c89546d
authored
Apr 10, 2024
by
Eamon Doyle
Browse files
updates to allow save in mergeRoiTool
parent
b5ff028b
Changes
2
Show whitespace changes
Inline
Side-by-side
mergeRoiTool.fig
View file @
5c89546d
No preview for this file type
mergeRoiTool.m
View file @
5c89546d
...
@@ -87,6 +87,33 @@ function pushbutton_save_Callback(hObject, eventdata, handles)
...
@@ -87,6 +87,33 @@ function pushbutton_save_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton_save (see GCBO)
% hObject handle to pushbutton_save (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% handles structure with handles and user data (see GUIDATA)
lungMatrix
=
handles
.
lungMatrix
;
savePath
=
[
handles
.
path
'/mergeLungROI'
];
fname
=
handles
.
curName
;
if
exist
(
savePath
,
'dir'
)
~=
7
mkdir
(
savePath
);
end
try
save
([
savePath
'/mergeLung-'
fname
'.mat'
],
'lungMatrix'
)
set
(
handles
.
checkbox_saved
,
'Value'
,
1
,
'BackgroundColor'
,
'g'
);
axes
(
handles
.
axes1
);
%warn('here')
h
=
imagesc
([
0
0
;
0
0
])
%set(h,'HitTest','off')
get
(
h
)
%set(h,'ButtonDownFcn',@axes1_ButtonDownFcn)
handles
.
needsReload
=
1
;
msgbox
(
'ROI Saved Successfully'
)
catch
h
=
warndlg
(
'Save failed. Nothing saved'
);
end
guidata
(
hObject
,
handles
);
%% old save function
%{
roi
=
handles
.
roi
;
roi
=
handles
.
roi
;
roiCoords
=
handles
.
roiCoords
;
roiCoords
=
handles
.
roiCoords
;
...
@@ -122,6 +149,8 @@ else
...
@@ -122,6 +149,8 @@ else
end
end
end
end
guidata
(
hObject
,
handles
);
guidata
(
hObject
,
handles
);
%}
% end old save function
%popup_sel_index = get(handles.popupmenu1, 'Value');
%popup_sel_index = get(handles.popupmenu1, 'Value');
%{
%{
switch
popup_sel_index
switch
popup_sel_index
...
@@ -406,7 +435,7 @@ if lms > -1
...
@@ -406,7 +435,7 @@ if lms > -1
for
m
=
1
:
size
(
handles
.
lungMatrix
,
2
)
-
1
for
m
=
1
:
size
(
handles
.
lungMatrix
,
2
)
-
1
xx
=
n
*
lms
;
xx
=
n
*
lms
;
yy
=
m
*
lms
;
yy
=
m
*
lms
;
switch
handles
.
lungMatrix
(
n
,
m
,
1
,
handles
.
currentSlice
)
switch
handles
.
lungMatrix
(
m
,
n
,
1
,
handles
.
currentSlice
)
case
1
case
1
cd
=
[
0.2
,
0.2
,
0.0
];
cd
=
[
0.2
,
0.2
,
0.0
];
case
2
case
2
...
@@ -433,7 +462,7 @@ newim = newim + overlay;
...
@@ -433,7 +462,7 @@ newim = newim + overlay;
h
=
imagesc
(
newim
);
h
=
imagesc
(
newim
);
set
(
h
,
'HitTest'
,
'off'
)
set
(
h
,
'HitTest'
,
'off'
)
set
(
h
,
'PickableParts'
,
'none'
)
set
(
h
,
'PickableParts'
,
'none'
)
set
(
handles
.
sliceNum
,
'String'
,
num2str
(
handles
.
currentSlice
));
set
(
handles
.
sliceCount
,
'String'
,
sprintf
(
'/ %i'
,
size
(
images
,
4
)));
set
(
handles
.
sliceCount
,
'String'
,
sprintf
(
'/ %i'
,
size
(
images
,
4
)));
if
lms
>
-
1
if
lms
>
-
1
hold
on
;
for
n
=
0
:
gridsize
:
imsize
(
1
);
hold
on
;
for
n
=
0
:
gridsize
:
imsize
(
1
);
...
@@ -472,7 +501,7 @@ if get(handles.slider2,'Max') ~= 1.1
...
@@ -472,7 +501,7 @@ if get(handles.slider2,'Max') ~= 1.1
h
=
imagesc
(
images
(:,:,
1
,
get
(
handles
.
slider2
,
'Value'
)));
h
=
imagesc
(
images
(:,:,
1
,
get
(
handles
.
slider2
,
'Value'
)));
colormap
(
'gray'
)
colormap
(
'gray'
)
set
(
h
,
'ButtonDownFcn'
,
@
axes1_ButtonDownFcn
);
set
(
h
,
'ButtonDownFcn'
,
@
axes1_ButtonDownFcn
);
redrawImage
(
hObject
,
eventdata
,
handles
);
end
end
guidata
(
hObject
,
handles
);
guidata
(
hObject
,
handles
);
...
@@ -542,7 +571,7 @@ axes(handles.axes1);
...
@@ -542,7 +571,7 @@ axes(handles.axes1);
gridsize
=
sqrt
((
x_coord
(
2
)
-
x_coord
(
1
))
.^
2
+
(
y_coord
(
2
)
-
y_coord
(
1
))
.^
2
);
gridsize
=
sqrt
((
x_coord
(
2
)
-
x_coord
(
1
))
.^
2
+
(
y_coord
(
2
)
-
y_coord
(
1
))
.^
2
);
gridsize
=
ceil
(
gridsize
);
gridsize
=
ceil
(
gridsize
);
imsize
=
size
(
handles
.
imageMat
);
imsize
=
size
(
handles
.
imageMat
);
lungMatrix
=
zeros
(
ceil
(
imsize
(
1
)
.
/
gridsize
),
ceil
(
imsize
(
2
)
.
/
gridsize
),
imsize
(
3
),
imsize
(
4
));
lungMatrix
=
zeros
(
floor
(
imsize
(
1
)
.
/
gridsize
),
floor
(
imsize
(
2
)
.
/
gridsize
),
imsize
(
3
),
imsize
(
4
));
handles
.
lungMatrix
=
lungMatrix
;
handles
.
lungMatrix
=
lungMatrix
;
handles
.
lungGridSize
=
gridsize
;
handles
.
lungGridSize
=
gridsize
;
hold
on
;
for
n
=
0
:
gridsize
:
imsize
(
1
);
hold
on
;
for
n
=
0
:
gridsize
:
imsize
(
1
);
...
@@ -556,8 +585,9 @@ for n=0:gridsize:imsize(2);
...
@@ -556,8 +585,9 @@ for n=0:gridsize:imsize(2);
set
(
h
,
'ButtonDownFcn'
,
@
axes1_ButtonDownFcn
)
set
(
h
,
'ButtonDownFcn'
,
@
axes1_ButtonDownFcn
)
end
end
%handles
%handles
guidata
(
hObject
,
handles
);
guidata
(
hObject
,
handles
);
redrawImage
(
hObject
,
eventdata
,
handles
);
%set(gca, 'ButtonDownFcn', @axes1_ButtonDownFcn);
%set(gca, 'ButtonDownFcn', @axes1_ButtonDownFcn);
%ax = gca;
%ax = gca;
%im.PickableParts = 'none';
%im.PickableParts = 'none';
...
@@ -587,7 +617,8 @@ lungMatLoc = floor(currentBox)
...
@@ -587,7 +617,8 @@ lungMatLoc = floor(currentBox)
lmy
=
floor
(
lungMatLoc
(
1
)
.
/
size
(
handles
.
imageMat
,
2
)
*
lungGridMatSize
(
2
))
lmy
=
floor
(
lungMatLoc
(
1
)
.
/
size
(
handles
.
imageMat
,
2
)
*
lungGridMatSize
(
2
))
lmx
=
floor
(
lungMatLoc
(
2
)
.
/
size
(
handles
.
imageMat
,
1
)
*
lungGridMatSize
(
1
))
lmx
=
floor
(
lungMatLoc
(
2
)
.
/
size
(
handles
.
imageMat
,
1
)
*
lungGridMatSize
(
1
))
currentSlice
=
get
(
handles
.
slider2
,
'Value'
);
currentSlice
=
get
(
handles
.
slider2
,
'Value'
);
handles
.
lungMatrix
(
lmy
,
lmx
,
1
,
currentSlice
)
=
mod
(
handles
.
lungMatrix
(
lmy
,
lmx
,
1
,
currentSlice
)
+
1
,
5
);
currentSlice
handles
.
lungMatrix
(
lmx
,
lmy
,
1
,
currentSlice
)
=
mod
(
handles
.
lungMatrix
(
lmx
,
lmy
,
1
,
currentSlice
)
+
1
,
5
);
handles
.
lungMatrix
(:,:,
1
,
currentSlice
);
handles
.
lungMatrix
(:,:,
1
,
currentSlice
);
guidata
(
hObject
,
handles
)
guidata
(
hObject
,
handles
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment