Skip to content

Commit

Permalink
VolumeCut 5.1
Browse files Browse the repository at this point in the history
+ Delete reference points from graphical editor
+ Choose which cut stack to save
+ Renamed loadImage.m to loadImageStack.m to disambiguate among apps
  • Loading branch information
lucadellasantina committed Sep 15, 2020
1 parent 4e849a4 commit a5d54b0
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 15 deletions.
8 changes: 7 additions & 1 deletion ChangeLog.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
%
% *Change log*
%
% _*Version 5.1* created on 2020-09-15 by Luca Della Santina_
%
% + Optional saving of different cut parts
% + Delete objects from graphical editor
% + Renamed loadImage.m to loadImageStack.m to disambiguate among apps
%
% _*Version 5.0* created on 2020-09-14 by Luca Della Santina_
%
% + Visual editor for fiducial cut points
Expand Down Expand Up @@ -164,4 +170,4 @@
% % bug fixed the file selector for reference points
%
% _*Version 1.0* created on 2017-09-01 by Luca Della Santina_
%
%
Binary file modified VolumeCut.mlapp
Binary file not shown.
Binary file modified VolumeCut.mlappinstall
Binary file not shown.
8 changes: 4 additions & 4 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="450805270" 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="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">
<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/tp6b9c4b36_a13f_45d6_bbd4_45541cf2fa4f.png</param.screenshot>
<param.version>5.0</param.version>
<param.screenshot>/tmp/tp0c8c39bb_7de3_4006_8bf6_fc3f84df506f.png</param.screenshot>
<param.version>5.1</param.version>
<param.products.name>
<item>MATLAB</item>
<item>Image Processing Toolbox</item>
Expand Down Expand Up @@ -46,7 +46,7 @@ Licensed under the term of GPL v3</param.description>
<file>${PROJECT_ROOT}/cutVolume.m</file>
<file>${PROJECT_ROOT}/editStruct.m</file>
<file>${PROJECT_ROOT}/gridfit.m</file>
<file>${PROJECT_ROOT}/loadImage.m</file>
<file>${PROJECT_ROOT}/loadImageStack.m</file>
<file>${PROJECT_ROOT}/markVolume2D.m</file>
<file>${PROJECT_ROOT}/saveastiff.m</file>
<file>${PROJECT_ROOT}/skel2mask.m</file>
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.0/VolumeCut.mlappinstall">Download VolumeCut</a>
<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">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: 51 additions & 0 deletions loadImageStack.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
%% VolumeCut: Cut images along custom surfaces
% Copyright (C) 2017,2018 Luca Della Santina
%
% This file is part of VolumeCut
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
% This software is released under the terms of the GPL v3 software license
%
function [I, Isize, Ires] = loadImageStack(PathName, FileName)
% Read the image size and resolution from file
tmpImInfo = imfinfo([PathName FileName]);
tmpImSizeZ = numel(tmpImInfo);
tmpImSizeX = tmpImInfo.Width;
tmpImSizeY = tmpImInfo.Height;
Isize = [tmpImSizeX, tmpImSizeY, tmpImSizeZ];

% Read image resolution data
try
tmpXYres = 1/tmpImInfo(1).XResolution;
if contains(tmpImInfo(1).ImageDescription, 'spacing=')
tmpPos = strfind(tmpImInfo(1).ImageDescription,'spacing=');
tmpZres = tmpImInfo(1).ImageDescription(tmpPos+8:end);
tmpZres = regexp(tmpZres,'\n','split');
tmpZres = str2double(tmpZres{1});
else
tmpZres = 0.3; % otherwise use default value
end
Ires = [tmpXYres, tmpXYres, tmpZres];
catch
Ires = [1,1,1];
end

% Load the image data into matlab
fprintf('Loading image stack... ');
I = uint8(ones(tmpImSizeX, tmpImSizeY, tmpImSizeZ));
for j = 1:tmpImSizeZ
I(:,:,j)=imread([PathName FileName], j);
end
fprintf('DONE\n');
end
36 changes: 27 additions & 9 deletions markVolume2D.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,17 @@
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);
btnDelete = uicontrol('Style','Pushbutton','Units','normalized','position',[.907,.480,.088,.04],'String','Delete Item (d)','Callback',@btnDelete_clicked); %#ok, unused variable

txtValidObjs = uicontrol('Style','text' ,'Units','normalized','position',[.907,.490,.085,.02],'String',['Total: ' num2str(size(Dots,3))]);
txtSelObj = uicontrol('Style','text' ,'Units','normalized','position',[.907,.460,.085,.02],'String','Selected Object info'); %#ok, unused variable
txtSelObjID = uicontrol('Style','text' ,'Units','normalized','position',[.907,.430,.085,.02],'String','ID# :');
txtSelObjPos = uicontrol('Style','text' ,'Units','normalized','position',[.907,.400,.085,.02],'String','Pos : ');
txtSelObjPix = uicontrol('Style','text' ,'Units','normalized','position',[.907,.370,.085,.02],'String','Voxels : ');
txtValidObjs = uicontrol('Style','text' ,'Units','normalized','position',[.907,.440,.085,.02],'String',['Total: ' num2str(size(Dots,3))]);
txtSelObj = uicontrol('Style','text' ,'Units','normalized','position',[.907,.410,.085,.02],'String','Selected Object info'); %#ok, unused variable
txtSelObjID = uicontrol('Style','text' ,'Units','normalized','position',[.907,.380,.085,.02],'String','ID# :');
txtSelObjPos = uicontrol('Style','text' ,'Units','normalized','position',[.907,.350,.085,.02],'String','Pos : ');
txtSelObjPix = uicontrol('Style','text' ,'Units','normalized','position',[.907,.320,.085,.02],'String','Voxels : ');

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


Expand Down Expand Up @@ -131,7 +132,24 @@ function lstDots_valueChanged(src,event) %#ok, unused arguments
scroll(frame, 'right');
end
end


function btnDelete_clicked(src,event) %#ok, unused arguments
% Remove selected object from the list
if SelObjID > 0
Dots.Pos(SelObjID, :) = [];
Dots.Vox(SelObjID) = [];
Dots.Filter(SelObjID) = [];

if SelObjID > numel(Dots.Filter)
SelObjID = numel(Dots.Filter);
set(lstDots, 'Value', 1);
end
PosZoom = [-1, -1];
lstDotsRefresh;
scroll(frame, 'right');
end
end

function ID = addDot(X, Y, D)
% Creates a new object #ID from pixels within R radius
% X,Y: center coordinates, R: radius in zoomed region pixels
Expand Down

0 comments on commit a5d54b0

Please sign in to comment.