User Tools

Site Tools


vmp.createsmp
no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


vmp.createsmp [2010/06/14 19:00] (current) – created jochen
Line 1: Line 1:
 +====== vmp.CreateSMP ======
 +
 +===== Motivation =====
 +Please refer to the [[Processing stream - Surface projection|Surface projection]] page for information on why to use this method and a practical example output.
 +
 +===== Method reference ('vmp.Help('CreateSMP')') =====
 +<file> VMP::CreateSMP  - sample SMPs from the maps in a VMP
 + 
 + FORMAT:       smp = vmp.CreateSMP(srf, opts)
 + 
 + Input fields:
 + 
 +       srf         required surface file
 +       opts        1x1 struct with optional fields
 +        .interp    method ('nearest', {'linear'}, 'cubic')
 +        .ipfrom    interpolate from P + n * normal vector, default: -3
 +        .ipstep    interpolation stepsize, default: 1 (in normal vectors)
 +        .ipto      interpolate to P + n * normal vector, default: 1
 +        .mapsel    map selection, default: all maps in VMP
 +        .method    method to get value ('max', {'mean'}, 'median', 'min')
 +        .recalcn   boolean, recalc normals before sampling, default: false
 + 
 + Output fields:
 + 
 +       smp         SMP object with as many maps as selected
 + 
 + Note: results slightly differ from BV's results (sampling method)</file>
 +
 +===== Usage examples =====
 +  * simple conversion of all maps in a VMP with default parameters: <code matlab vmp_createsmp_example1.m>% load VMP and SRF
 +vmp = xff('*.vmp', 'Please select a VMP for SMP creation...');
 +srf = xff('*.srf', 'Please select a surface to sample VMP at...');
 +
 +% convert to SMP
 +smp = vmp.CreateSMP(srf);
 +
 +% save as and clear all VMP/SRF objects
 +smp.SaveAs;
 +vmp.ClearObject;
 +srf.ClearObject;</code>
 +  * only convert first map with cubic interpolation and sampled just at the vertex: <code matlab vmp_createsmp_example2.m>smpcreateopts = struct( ...
 +    'interp', 'cubic', ...
 +    'ipfrom', 0, ...
 +    'ipto',   0, ...
 +    'mapsel', 1);
 +smp = vmp.CreateSMP(srf, smpcreateopts);</code>
 +  * recreate normals before sampling: <code matlab vmp_createsmp_example3.m>smp = vmp.CreateSMP(srf, struct('recalcn', true));</code>
  
vmp.createsmp.txt · Last modified: 2010/06/14 19:00 by jochen