Back to the main page.

Bug 3266 - mesh smoothing

Status CLOSED FIXED
Reported 2017-03-10 03:20:00 +0100
Modified 2019-08-10 12:41:40 +0200
Product: FieldTrip
Component: preproc
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P5 normal
Assigned to: Arjen Stolk
URL:
Tags:
Depends on:
Blocks:
See also:

Arjen Stolk - 2017-03-10 03:20:38 +0100

There's a smoothing subfunction named 'fairsurface' in ft_prepare_mesh_headshape that seems to do a proper job at smoothing a mesh without shrinking it. ft_prepare_mesh_headshape can be reached by: cfg = []; cfg.headshape = mesh; cfg.method = 'headshape'; mesh_sm = ft_prepare_mesh(cfg); However, ft_prepare_mesh_headshape calls fairsurface with a fixed, non-configurable smoothing parameter. Would it be an idea to make it configurable (e.g. cfg.smooth, or cfg.smoothiter)? Alternatively, could we house the fairsurface functionality under a dedicated mesh smoothing function/ft_prepare_mesh submethod?


Robert Oostenveld - 2017-03-10 12:58:36 +0100

We discussed at multiple occasions in the past to make a mesh sub-toolbox, just like fileio, preproc, plotting, etc. That would allow power users to bypass the high-level FT cfg interface. It never happened, and I don't think it will. There is not enough need for it for someone to devote time to convert existing functionality (mainly private) into a well structured, consistent and documented set of functions. The functionality that you describe seems too specific to be of general interest. I suggest you just rip out the relevant functions from private and just keep it to yourself. OK?


Arjen Stolk - 2017-03-10 19:00:30 +0100

Created attachment 831 even camlight does not like unsmoothed meshes


Arjen Stolk - 2017-03-10 19:05:39 +0100

Not giving up that easily :) https://github.com/fieldtrip/fieldtrip/pull/368


Arjen Stolk - 2017-03-10 20:10:02 +0100

[ftver, ftpath] = ft_version; atlas = ft_read_atlas([ftpath filesep 'template/atlas/aal/ROI_MNI_V4.nii']); mri_spm = ft_read_mri([ftpath filesep 'external/spm8/templates/T1.nii']); mri_spm.coordsys = 'mni'; % left hipp cfg = []; cfg.inputcoord = 'mni'; cfg.atlas = atlas; cfg.roi = 'Hippocampus_L'; hpcL_mask = ft_volumelookup(cfg, mri_spm); seg.dim = mri_spm.dim; seg.unit = mri_spm.unit; seg.coordsys = mri_spm.coordsys; seg.transform = mri_spm.transform; seg.brain = hpcL_mask; cfg = []; cfg.tissue = 'brain'; cfg.numvertices = 3000; hpcL_mesh = ft_prepare_mesh(cfg, seg); cfg = []; cfg.headshape = hpcL_mesh; cfg.method = 'headshape'; cfg.smooth = 5; hpcL_mesh_sm = ft_prepare_mesh(cfg);


Arjen Stolk - 2017-03-10 20:10:18 +0100

figure; ft_plot_mesh([hpcL_mesh], 'facecolor', 'cortex_light', 'edgecolor', 'none') material dull; view([-100 20]); lighting gouraud; camlight figure; ft_plot_mesh([hpcL_mesh_sm], 'facecolor', 'cortex_light', 'edgecolor', 'none') material dull; view([-100 20]); lighting gouraud; camlight


Robert Oostenveld - 2017-03-11 10:54:45 +0100

(In reply to Arjen Stolk from comment #5) agreed, the change is a clean extension of the existing interface. Please see the PR for comments.


Arjen Stolk - 2017-03-11 19:26:41 +0100

PR updated


Robert Oostenveld - 2019-08-10 12:35:26 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue on https://github.com/fieldtrip/fieldtrip/issues.


Robert Oostenveld - 2019-08-10 12:41:40 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue on https://github.com/fieldtrip/fieldtrip/issues.