Home > utility > feClipFiberNodes.m

feClipFiberNodes

PURPOSE ^

Clip a fiber to be constrained inside a predefiend volume (x,y,z

SYNOPSIS ^

function nodesToKeep = feClipFiberNodes(fiber,coords, maxVolDistance)

DESCRIPTION ^

 Clip a fiber to be constrained inside a predefiend volume (x,y,z
 coordinates).
 
  function nodesToKeep = feClipFiberNodes(fiber,coords, maxVolDistance)
 
 INPUTS:
        fiber          - A fiber, defined as a 3xN array of x,y,z coordinates. 
                         E.g., fg.fibers{1}.
        coords         - A volume of defined as a 3xN array of x,y,z coordinates.
        maxVolDistance - The farther distance (in mm) from the volume a node can
                         be to be kept in the fiber.
        
 OUTPUTS:
        nodesToKeep    - Vector of ones and zeros indicating the nodes to
                         be kept in the fiber. 1 means "keep the node."

 SEE ALSO: feClipFibersToVolume.m, feConnectomePreprocess.m


 Copyright (2013-2014), Franco Pestilli, Stanford University, pestillifranco@gmail.com.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function nodesToKeep = feClipFiberNodes(fiber,coords, maxVolDistance)
0002 % Clip a fiber to be constrained inside a predefiend volume (x,y,z
0003 % coordinates).
0004 %
0005 %  function nodesToKeep = feClipFiberNodes(fiber,coords, maxVolDistance)
0006 %
0007 % INPUTS:
0008 %        fiber          - A fiber, defined as a 3xN array of x,y,z coordinates.
0009 %                         E.g., fg.fibers{1}.
0010 %        coords         - A volume of defined as a 3xN array of x,y,z coordinates.
0011 %        maxVolDistance - The farther distance (in mm) from the volume a node can
0012 %                         be to be kept in the fiber.
0013 %
0014 % OUTPUTS:
0015 %        nodesToKeep    - Vector of ones and zeros indicating the nodes to
0016 %                         be kept in the fiber. 1 means "keep the node."
0017 %
0018 % SEE ALSO: feClipFibersToVolume.m, feConnectomePreprocess.m
0019 %
0020 %
0021 % Copyright (2013-2014), Franco Pestilli, Stanford University, pestillifranco@gmail.com.
0022 
0023 % Compute the squared distance between each node on fiber ii and the
0024 % nearest roi coordinate
0025 [~, nodesSQdist] = nearpoints(fiber, coords');
0026 
0027 % Take the square root of this distance and keep the nodes that are that
0028 % distance inside the volume.
0029 nodesToKeep = sqrt(nodesSQdist) <= maxVolDistance;    
0030 
0031 end % Function

Generated on Wed 02-Jul-2014 17:17:39 by m2html © 2005