function vmr = spheresvmr_sample % spheresvmr_sample - create a VMR with 10 small spheres % % FORMAT: vmr = spheresvmr_sample; % % No input fields. % % Output fields: % % vmr VMR object with 10 spheres % create VMR object (output) vmr = xff('new:vmr'); % create VOI object as a helper voi = xff('new:voi'); % create 10 spheres in VOI for c = 1:10 voi.AddSphericalVOI(min(120, max(-120, round(40 * randn(1, 3)))), 7); end % set those coordinates to 200 in VMR for c = 1:10 vmr.VMRData(bvcoordconv(voi.VOI(c).Voxels, 'tal2bvc', vmr.BoundingBox)) = 200; end % make sure VMR is not affected by garbage collection bless(vmr, 1); % destroy voi (would be removed by garbage collection some time later otherwise) voi.ClearObject; % end of function