Skip to content

Commit 92c9d20

Browse files
FIX - resolved invalid pointcloud datatype, see http://bugzilla.fieldtriptoolbox.org/show_bug.cgi?id=3158
1 parent f4fd837 commit 92c9d20

File tree

3 files changed

+10
-20
lines changed

3 files changed

+10
-20
lines changed

fileio/private/ft_checkdata.m

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@
130130
isfreqmvar = ft_datatype(data, 'freqmvar');
131131
ischan = ft_datatype(data, 'chan');
132132
ismesh = ft_datatype(data, 'mesh');
133-
ispointcloud = ft_datatype(data, 'pointcloud');
134133
% FIXME use the istrue function on ismeg and hasxxx options
135134

136135
if ~isequal(feedback, 'no')
@@ -211,9 +210,6 @@
211210
else
212211
fprintf('the input is mesh data multiple surfaces\n');
213212
end
214-
elseif ispointcloud
215-
data = fixpos(data);
216-
fprintf('the input is point cloud data with %d vertices ', size(data.pos,1));
217213
end % give feedback
218214

219215
if issource && isvolume
@@ -222,6 +218,7 @@
222218
data = rmfield(data, 'pos');
223219
issource = false;
224220
end
221+
225222
% the ft_datatype_XXX functions ensures the consistency of the XXX datatype
226223
% and provides a detailed description of the dataformat and its history
227224
if iscomp % this should go before israw/istimelock/isfreq
@@ -291,8 +288,6 @@
291288
okflag = okflag + isparcellation;
292289
case 'mesh'
293290
okflag = okflag + ismesh;
294-
case 'pointcloud'
295-
okflag = okflag + ispointcloud;
296291
end % switch dtype
297292
end % for dtype
298293

ft_defacevolume.m

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,10 @@
7171
cfg.feedback = ft_getopt(cfg, 'feedback', 'yes');
7272

7373
% check if the input data is valid for this function
74-
mri = ft_checkdata(mri, 'datatype', {'volume', 'mesh', 'pointcloud'}, 'feedback', 'yes');
74+
mri = ft_checkdata(mri, 'datatype', {'volume', 'mesh'}, 'feedback', 'yes');
7575

7676
ismri = ft_datatype(mri, 'mri');
7777
ismesh = ft_datatype(mri, 'mesh');
78-
ispointcloud = ft_datatype(mri,'pointcloud');
7978

8079
% determine the size of the "unit" sphere in the origin and the length of the axes
8180
switch mri.unit
@@ -114,7 +113,7 @@
114113
anatomy = (mri.anatomy-clim(1))/(clim(2)-clim(1));
115114

116115
ft_plot_ortho(anatomy, 'transform', mri.transform, 'unit', mri.unit, 'resolution', resolution, 'style', 'intersect');
117-
elseif ismesh || ispointcloud
116+
elseif ismesh
118117
ft_plot_mesh(mri);
119118
end
120119

@@ -187,7 +186,7 @@
187186
voxpos(:,3) > -0.5 & ...
188187
voxpos(:,3) < +0.5;
189188

190-
elseif ismesh || ispointcloud
189+
elseif ismesh
191190
meshpos = ft_warp_apply(inv(T*R*S), mri.pos); % mesh vertex positions in box coordinates
192191

193192
remove = ...
@@ -236,13 +235,14 @@
236235

237236
elseif ismesh
238237
fprintf('keeping %d and removing %d vertices in the mesh\n', sum(remove==0), sum(remove==1));
239-
[mri.pos, mri.tri] = remove_vertices(mri.pos, mri.tri, remove);
238+
if isfield(mri, 'tri')
239+
[mri.pos, mri.tri] = remove_vertices(mri.pos, mri.tri, remove);
240+
else
241+
mri.pos = mri.pos(remove,1:3);
242+
end
240243
if isfield(mri, 'color')
241244
mri.color = mri.color(~remove,:);
242245
end
243-
elseif ispointcloud
244-
fprintf('keeping %d and removing %d vertices in the mesh\n', sum(remove==0), sum(remove==1));
245-
mri.pos = mri.pos(remove,1:3);
246246
end
247247

248248
% remove the temporary fields from the configuration, keep the rest for provenance

utilities/ft_checkdata.m

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@
130130
isfreqmvar = ft_datatype(data, 'freqmvar');
131131
ischan = ft_datatype(data, 'chan');
132132
ismesh = ft_datatype(data, 'mesh');
133-
ispointcloud = ft_datatype(data, 'pointcloud');
134133
% FIXME use the istrue function on ismeg and hasxxx options
135134

136135
if ~isequal(feedback, 'no')
@@ -211,9 +210,6 @@
211210
else
212211
fprintf('the input is mesh data multiple surfaces\n');
213212
end
214-
elseif ispointcloud
215-
data = fixpos(data);
216-
fprintf('the input is point cloud data with %d vertices ', size(data.pos,1));
217213
end % give feedback
218214

219215
if issource && isvolume
@@ -222,6 +218,7 @@
222218
data = rmfield(data, 'pos');
223219
issource = false;
224220
end
221+
225222
% the ft_datatype_XXX functions ensures the consistency of the XXX datatype
226223
% and provides a detailed description of the dataformat and its history
227224
if iscomp % this should go before israw/istimelock/isfreq
@@ -291,8 +288,6 @@
291288
okflag = okflag + isparcellation;
292289
case 'mesh'
293290
okflag = okflag + ismesh;
294-
case 'pointcloud'
295-
okflag = okflag + ispointcloud;
296291
end % switch dtype
297292
end % for dtype
298293

0 commit comments

Comments
 (0)