Skip to content

Commit

Permalink
VolumeCut 5.2
Browse files Browse the repository at this point in the history
+ Removed refine tool
+ Fixed misalignment of crosshair sensitivity point
+ Selecting point onscreen selects correspoing item on listbox
  • Loading branch information
lucadellasantina committed Sep 19, 2020
1 parent a5d54b0 commit 3199c97
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 109 deletions.
6 changes: 6 additions & 0 deletions ChangeLog.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
%
% *Change log*
%
% _*Version 5.2* created on 2020-09-19 by Luca Della Santina_
%
% + Removed Refine tool
% + Fixed misalignment of sensitive point on crossbar
% + Selecting a reference point on-screen selects corresponding on table
%
% _*Version 5.1* created on 2020-09-15 by Luca Della Santina_
%
% + Optional saving of different cut parts
Expand Down
Binary file modified VolumeCut.mlapp
Binary file not shown.
Binary file modified VolumeCut.mlappinstall
Binary file not shown.
6 changes: 3 additions & 3 deletions VolumeCut.prj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<deployment-project plugin="plugin.apptool" plugin-version="1.0">
<configuration build-checksum="3829748756" file="/home/luca/Dropbox/MATLAB scripts/VolumeCut/VolumeCut.prj" location="/home/luca/Dropbox/MATLAB scripts/VolumeCut" name="VolumeCut" target="target.mlapps" target-name="Package App">
<configuration build-checksum="1030704090" file="/home/luca/Dropbox/MATLAB scripts/VolumeCut/VolumeCut.prj" location="/home/luca/Dropbox/MATLAB scripts/VolumeCut" name="VolumeCut" target="target.mlapps" target-name="Package App">
<param.appname>VolumeCut</param.appname>
<param.authnamewatermark>Luca Della Santina</param.authnamewatermark>
<param.email />
Expand All @@ -13,8 +13,8 @@
<param.summary>Cut image volumes along arbitrary surfaces</param.summary>
<param.description>Copyright 2017-2020 Luca Della Santina
Licensed under the term of GPL v3</param.description>
<param.screenshot>/tmp/tp0c8c39bb_7de3_4006_8bf6_fc3f84df506f.png</param.screenshot>
<param.version>5.1</param.version>
<param.screenshot>/tmp/tp489585b8_6c52_4d28_9f0f_ccadc601ae7f.png</param.screenshot>
<param.version>5.2</param.version>
<param.products.name>
<item>MATLAB</item>
<item>Image Processing Toolbox</item>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h2 id="project_tagline">Cut image volumes along arbitrary surfaces</h2>

<section class="outer">
<div class="downloads inner">
<a class="zip_download_link" href="https://github.com/lucadellasantina/VolumeCut/releases/download/v5.1/VolumeCut.mlappinstall">Download VolumeCut</a>
<a class="zip_download_link" href="https://github.com/lucadellasantina/VolumeCut/releases/download/v5.2/VolumeCut.mlappinstall">Download VolumeCut</a>
<a class="zip_download_link" href="https://github.com/lucadellasantina/VolumeCut/releases">Release notes</a>
<a class="zip_download_link" href="https://github.com/lucadellasantina/VolumeCut/wiki">User manual</a>
<a class="zip_download_link" href="https://github.com/lucadellasantina/VolumeCut/issues">Report an issue</a>
Expand Down
51 changes: 0 additions & 51 deletions loadImage.m

This file was deleted.

76 changes: 22 additions & 54 deletions markVolume2D.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
pnlSettings = uipanel( 'Title','Objects' ,'Units','normalized','Position',[.903,.005,.095,.99]); %#ok, unused variable
btnLoad = uicontrol('Style','Pushbutton','Units','normalized','position',[.907,.920,.088,.05],'String','Load objects','Callback',@btnLoad_clicked); %#ok, unused variable
txtAction = uicontrol('Style','text' ,'Units','normalized','position',[.912,.875,.020,.02],'String','Tool:'); %#ok, unused handle
cmbAction = uicontrol('Style','popup' ,'Units','normalized','Position',[.935,.860,.055,.04],'String', {'Add (a)','Select (s)', 'Refine (r)'},'Callback', @cmbAction_changed);
cmbAction = uicontrol('Style','popup' ,'Units','normalized','Position',[.935,.860,.055,.04],'String', {'Add (a)','Select (s)'},'Callback', @cmbAction_changed);
chkShowObjects = uicontrol('Style','checkbox' ,'Units','normalized','position',[.912,.830,.085,.02],'String','Show (spacebar)', 'Value',1,'Callback',@chkShowObjects_changed);
chkShowAllZ = uicontrol('Style','checkbox' ,'Units','normalized','position',[.912,.790,.085,.02],'String','Ignore Z (Z)', 'Value',1,'Callback',@chkShowAllZ_changed);
lstDots = uicontrol('Style','listbox' ,'Units','normalized','position',[.907,.530,.085,.25],'String',[],'Callback',@lstDots_valueChanged);
Expand All @@ -60,8 +60,8 @@
txtSelObjPix = uicontrol('Style','text' ,'Units','normalized','position',[.907,.320,.085,.02],'String','Voxels : ');

txtZoom = uicontrol('Style','text' ,'Units','normalized','position',[.925,.290,.050,.02],'String','Zoom level:'); %#ok, unused variable
btnZoomOut = uicontrol('Style','Pushbutton','Units','normalized','position',[.920,.230,.030,.05],'String','-' ,'Callback',@btnZoomOut_clicked); %#ok, unused variable
btnZoomIn = uicontrol('Style','Pushbutton','Units','normalized','position',[.950,.230,.030,.05],'String','+' ,'Callback',@btnZoomIn_clicked); %#ok, unused variable
btnZoomOut = uicontrol('Style','Pushbutton','Units','normalized','position',[.920,.230,.030,.05],'String','-','Callback',@btnZoomOut_clicked); %#ok, unused variable
btnZoomIn = uicontrol('Style','Pushbutton','Units','normalized','position',[.950,.230,.030,.05],'String','+','Callback',@btnZoomIn_clicked); %#ok, unused variable
btnSave = uicontrol('Style','Pushbutton','Units','normalized','position',[.907,.050,.088,.05],'String','Save objects','Callback',@btnSave_clicked); %#ok, unused variable


Expand Down Expand Up @@ -189,15 +189,13 @@ function cmbAction_changed(src,event) %#ok, unused parameters
switch get(src,'Value')
case 1, actionType = 'Add';
case 2, actionType = 'Select';
case 3, actionType = 'Refine';
end
end

function cmbAction_assign(newType)
switch newType
case 'Add', set(cmbAction, 'Value', 1);
case 'Select', set(cmbAction, 'Value', 2);
case 'Refine', set(cmbAction, 'Value', 3);
end
end

Expand Down Expand Up @@ -571,19 +569,18 @@ function on_click(src, event) %#ok, unused arguments
if isvalid(brush), delete(brush); end

elseif PosX <= size(I,2)*2

% Mouse in Right Panel, act depending of the selected tool
switch actionType
case {'Enclose', 'Select'}
case 'Select'
oldPointer = get(fig_handle, 'Pointer');
if ~strcmp(oldPointer, 'watch')
[PCData, PHotSpot] = getPointerCrosshair;
set(fig_handle, 'Pointer', 'custom', 'PointerShapeCData', PCData, 'PointerShapeHotSpot', PHotSpot);
end
if isvalid(brush), delete(brush); end
case {'Add', 'Refine', 'MagicWand'}
% Display a circle if we are in the right panel
return

case 'Add'
% Recreate the brush because frame is redrawn otherwise
% just redraw the brush in the new location
ZoomFactor = size(I,1) / CutNumVox(1);
Expand Down Expand Up @@ -698,37 +695,6 @@ function on_click(src, event) %#ok, unused arguments
max(CutNumVox(1)/2+1,Pos(2)), frame];
Pos = [min(size(ImStk,2)-CutNumVox(2)/2,Pos(1)),...
min(size(ImStk,1)-CutNumVox(1)/2,Pos(2)),frame];

case 'Refine'
PosZoom = [PosZoomX, PosZoomY frame];
Pos = [Pos(1), Pos(2) frame];

% Absolute position on image of point clicked on right panel
% position Pos. Note: Pos(2) is X, Pos(1) is Y
fymin = max(ceil(Pos(2) - CutNumVox(1)/2), 1);
fymax = min(ceil(Pos(2) + CutNumVox(1)/2), size(ImStk,1));
fxmin = max(ceil(Pos(1) - CutNumVox(2)/2), 1);
fxmax = min(ceil(Pos(1) + CutNumVox(2)/2), size(ImStk,2));
fxpad = CutNumVox(1) - (fxmax - fxmin); % add padding if position of selected rectangle fall out of image
fypad = CutNumVox(2) - (fymax - fymin); % add padding if position of selected rectangle fall out of image
absX = fxpad+fxmin+PosZoom(1);
absY = fypad+fymin+PosZoom(2);

if absX>0 && absX<=size(ImStk,2) && absY>0 && absY<=size(ImStk,1)
% Remove selected polygon

[PCData, PHotSpot] = getPointerCrosshair;
set(fig_handle, 'Pointer', 'custom', 'PointerShapeCData', PCData, 'PointerShapeHotSpot', PHotSpot);
if isvalid(brush), delete(brush); end

% Add selected pixels to Dot #ID
if ~isvalid(animatedLine)
animatedLine = animatedline('LineWidth', 1, 'Color', 'blue');
else
addpoints(animatedLine, PosX, PosY);
end
return
end
end


Expand Down Expand Up @@ -756,19 +722,21 @@ function on_click(src, event) %#ok, unused arguments
ZoomFactor = size(I,1) / CutNumVox(1);
brushSizeScaled = brushSize * ZoomFactor;
addDot(absX, absY, brushSizeScaled);

case {'Select', 'Refine'}
% Set mouse pointer shape to a crosshair
[PCData, PHotSpot] = getPointerCrosshair;
set(fig_handle, 'Pointer', 'custom', 'PointerShapeCData', PCData, 'PointerShapeHotSpot', PHotSpot);
if isvalid(brush), delete(brush); end

% Add selected pixels to Dot #ID
if ~isvalid(animatedLine)
animatedLine = animatedline('LineWidth', 1, 'Color', 'blue');
else
addpoints(animatedLine, PosX, PosY);
end

case 'Select'
% Locate position of points in respect to zoom area
PosZoomX = PosX - size(ImStk,2)-1;
PosZoomX = round(PosZoomX * CutNumVox(2)/(size(ImStk,2)-1));
PosZoomY = size(ImStk,1) - PosY;
PosZoomY = CutNumVox(1)-round(PosZoomY*CutNumVox(1)/(size(ImStk,1)-1));
PosZoom = [PosZoomX, PosZoomY];

% Select the Dot below mouse pointer
set(fig_handle, 'CurrentAxes', axes_handle);
SelObjID = redraw(frame_handle, rect_handle, frame, chkShowObjects.Value, Pos, PosZoom, ImStk, CutNumVox, Dots, Dots.Filter, 0, 'right', chkShowAllZ.Value);
if SelObjID > 0
set(lstDots, 'Value', SelObjID);
end
return
end
end
Expand Down Expand Up @@ -960,5 +928,5 @@ function scroll(new_f, WhichPanel)
ShapeCData(:, 15:17)= 1;
ShapeCData(16,:) = 2;
ShapeCData(:, 16) = 2;
HotSpot = [16,16];
HotSpot = [8,20];
end

0 comments on commit 3199c97

Please sign in to comment.