Skip to content

Commit 69c299c

Browse files
author
James Anderson
committed
Additional option for flipping the Z axis
1 parent 51be9c2 commit 69c299c

4 files changed

Lines changed: 43 additions & 28 deletions

File tree

CreateRenderingFigure.m

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,30 @@
11
function [ hFig, hAxes ] = CreateRenderingFigure(varargin)
22
%CREATERENDERINGFIGURE Create the figure used to render meshes
3+
%WindowSize - Size of window, tuple
4+
%Renderer - Renderer to use, string
5+
%ReverseZ - bool, if true reverse the Z-axis
36

47
WindowSize = [0 0 1024 768];
58
renderer = 'opengl';
9+
ZDir = 'normal';
10+
light_elevation = 30;
611

712
optargin = size(varargin,2);
8-
if(optargin == 1)
13+
if(optargin >= 1)
914
WindowSize = varargin{1};
10-
elseif(optargin == 2)
11-
WindowSize = varargin{1};
15+
end
16+
if(optargin >= 2)
1217
renderer = varargin{2};
1318
end
19+
if(optargin >= 3)
20+
ReverseZ = varargin{3};
21+
if(ReverseZ)
22+
ZDir = 'reverse';
23+
light_elevation = -light_elevation;
24+
end
25+
end
26+
27+
1428

1529
hFig = figure('Units', 'Pixels', ...
1630
'OuterPosition', WindowSize, ...
@@ -23,12 +37,14 @@
2337
'YColor', [.5 .5 .5], ...
2438
'ZColor', [.5 .5 .5], ...
2539
'Position', [0 0 1 1], ...
26-
'DataAspectRatio', [1 1 1]);
40+
'DataAspectRatio', [1 1 1], ...
41+
'ZDir', ZDir);
2742

2843
hold on;
2944

30-
lightangle(45,30);
31-
lightangle(225,30);
45+
46+
lightangle(45,light_elevation);
47+
lightangle(225,light_elevation);
3248

3349
end
3450

PPlot2.m

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,7 @@ function PPlot2(Structs, Locs, LocLinks, scale_struct, VolumeName, varargin)
152152
% scale_struct.X.Value = .001;
153153
% scale_struct.Y.Value = .001;
154154
% scale_struct.Z.Value = .045;
155-
156-
157-
if InvertZ
158-
scale_struct.Z.Value = scale_struct.Z.Value * -1;
159-
end
160-
155+
161156
%Scale the coordinates, keeps a copy of the original data
162157
if(~isnan(MinZ))
163158
MinZ = scale_struct.Z.Value * MinZ;
@@ -167,6 +162,12 @@ function PPlot2(Structs, Locs, LocLinks, scale_struct, VolumeName, varargin)
167162
MaxZ = scale_struct.Z.Value * MaxZ;
168163
end
169164

165+
if(MinZ > MaxZ)
166+
temp = MinZ;
167+
MinZ = MaxZ;
168+
MaxZ = temp;
169+
end
170+
170171
Locs = ScaleLocations(Locs, scale_struct);
171172

172173
for(iStruct = 1:numStructs)
@@ -685,7 +686,7 @@ function PPlot2(Structs, Locs, LocLinks, scale_struct, VolumeName, varargin)
685686
end
686687

687688
disp('Creating figure...');
688-
[hFig, hAxes] = CreateRenderingFigure();
689+
[hFig, hAxes] = CreateRenderingFigure(WindowSize, renderer, InvertZ);
689690

690691
%
691692
% hFig = figure('Units', 'Pixels', ...
@@ -701,11 +702,6 @@ function PPlot2(Structs, Locs, LocLinks, scale_struct, VolumeName, varargin)
701702
% 'Position', [0 0 1 1], ...
702703
% 'DataAspectRatio', [1 1 1]);
703704

704-
hold on;
705-
706-
lightangle(45,30);
707-
lightangle(225,30);
708-
709705
disp('Rendering structures...');
710706
SceneBox = [];
711707
for iPID = 1:length(StructureIDs)
@@ -759,9 +755,9 @@ function PPlot2(Structs, Locs, LocLinks, scale_struct, VolumeName, varargin)
759755
% 'String', 'Y');
760756
% set(get(gca,'ZLabel'), 'Color', [0.5 0.5 0.5], ...
761757
% 'String', 'IPL Depth (nm)');
762-
set(gca, 'YTick', []);
763-
camroll(180);
764-
758+
% set(gca, 'YTick', []);
759+
%camroll(180);
760+
765761
% title('Laminae of Inner Nuclear Layer Cells');
766762
%
767763

VikingPlot.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function VikingPlot( varargin )
22

33
disp('');
4-
disp('Version: 1.0.2019.04.09');
4+
disp('Version: 1.0.2019.04.23');
55
disp('');
66

77
dbstop if error
@@ -31,7 +31,7 @@ function VikingPlot( varargin )
3131
ColladaPath = []; %The path to write .dae files to, if not specified .dae files are not written
3232
Query = {};
3333
IDFileNames = {};
34-
InvertZ = false;
34+
InvertZ = true;
3535
MinZ = NaN;
3636
MaxZ = NaN;
3737

@@ -136,9 +136,9 @@ function VikingPlot( varargin )
136136
ColladaPath = varargin{iArg+1};
137137
SkipNextArgument = true;
138138
elseif(strcmpi(varargin{iArg},'-z'))
139-
InvertZ = true;
139+
InvertZ = false;
140140
elseif(strcmpi(varargin{iArg},'-InvertZ'))
141-
InvertZ = true;
141+
InvertZ = false;
142142
elseif(strcmpi(varargin{iArg},'-MinZ') )
143143
MinZ = str2num(varargin{iArg+1});
144144
SkipNextArgument = true;

VikingPlot.prj

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<deployment-project plugin="plugin.ezdeploy" plugin-version="1.0">
2-
<configuration build-checksum="3996273110" file="C:\src\git\VikingPlot\VikingPlot.prj" location="C:\src\git\VikingPlot" name="VikingPlot" preferred-package-location="C:\src\git\VikingPlot\VikingPlot\for_redistribution" preferred-package-type="package.type.exe" target="target.ezdeploy.standalone" target-name="Application Compiler">
2+
<configuration build-checksum="2565003330" file="C:\src\git\VikingPlot\VikingPlot.prj" location="C:\src\git\VikingPlot" name="VikingPlot" preferred-package-location="C:\src\git\VikingPlot\VikingPlot\for_redistribution" preferred-package-type="package.type.exe" target="target.ezdeploy.standalone" target-name="Application Compiler">
33
<param.appname>VikingPlot</param.appname>
44
<param.icon />
55
<param.icons />
6-
<param.version>1.07</param.version>
6+
<param.version>1.09</param.version>
77
<param.authnamewatermark>James Anderson</param.authnamewatermark>
88
<param.email>james.r.anderson@utah.edu</param.email>
99
<param.company>University of Utah</param.company>
1010
<param.summary>VikingPlot creates 3D renderings of cells for the Viking Annotation system</param.summary>
1111
<param.description />
1212
<param.screenshot>${PROJECT_ROOT}\VikingPlotThumbnail.png</param.screenshot>
1313
<param.guid />
14-
<param.installpath.string>VikingPlot-1.03.2016.09.23</param.installpath.string>
14+
<param.installpath.string>VikingPlot-1.03.2019.04.09</param.installpath.string>
1515
<param.installpath.combo>option.installpath.programfiles</param.installpath.combo>
1616
<param.logo />
1717
<param.install.notes />
@@ -45,6 +45,9 @@
4545
<unset>
4646
<param.icon />
4747
<param.icons />
48+
<param.authnamewatermark />
49+
<param.email />
50+
<param.company />
4851
<param.description />
4952
<param.guid />
5053
<param.installpath.combo />

0 commit comments

Comments
 (0)