Main Content

bwselect3

Select objects in binary volume

Description

example

J= bwselect3(V,c,r,p)returns the binary volumeJcontaining the objects that overlap the voxel (r,c,p). Objects are connected sets of voxels with the value1

J= bwselect3(V,c,r,p,n)also specifies the connectivity,n, used to define objects.

[J,idx] = bwselect3(___)returns inidxthe linear indices of voxels belonging to the selected objects.

[x,y,z,J,idx,xi,yi,zi] = bwselect3(___)also returns thex,y, andzextents of the binary volume and the (xi,yi,zi) coordinates of selected voxels. By default,bwselect3uses the intrinsic coordinate system so thatx,y, andzare the volumeXData,YData, andZData

[___] = bwselect3(x,y,z,V,xi,yi,zi)establishes a nondefault world coordinate system forVfrom the vectorsx,y, andz。The argumentsxi,yi, andzispecify voxel coordinates in the world coordinate system.

Examples

collapse all

Load a volume and change its name toV

loadmristack; V = mristack;

Define a set of points in the volume.

C = [126 87 11]; R = [34 120 20]; P = [20 2 12];

Return a volume that contains objects that intersect with the points specified.

J = bwselect3(V,C,R,P);

Input Arguments

collapse all

Binary volume, specified as a 3-D numeric array or 3-D logical array.

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64|logical

Row index of voxels in objects of interest, specified as a numeric scalar or numeric vector. If you specify a vector, thenrmust be the same length ascandp。输出二进制volumeJcontains the sets of objects overlapping with any of the voxels (r(k),c(k),p(k)), wherekis an index into the vector.

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Column index of voxels in objects of interest, specified as a numeric scalar or numeric vector. If you specify a vector, thencmust be the same length asrandp。输出二进制volumeJcontains the sets of objects overlapping with any of the voxels (r(k),c(k),p(k)), wherekis an index into the vector.

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Plane index of voxels in objects of interest, specified as a numeric scalar or numeric vector. If you specify a vector, thenpmust be the same length asrandc。输出二进制volumeJcontains the sets of objects overlapping with any of the voxels (r(k),c(k),p(k)), wherekis an index into the vector.

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Connectivity, specified as one of these values.

Connectivities

瓦尔ue Connectivity
6 6-connected objects (Face-Face)
18 18-connected对象(面和Edge-Edge)
26 26-connected objects (Face-Face, Edge-Edge, and Vertex-Vertex)

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Worldx-axis coordinates, specified as a numeric scalar or numeric vector of the same length asyandz。Usex,y, andzto establish a nondefault spatial coordinate system. If you do not specify a coordinate system, then by defaultbwselect3uses the intrinsic coordinate system in whichxis [1,size(J,2)].

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Worldy-axis coordinates, specified as a numeric scalar or numeric vector of the same length asxandz。Usex,y, andzto establish a nondefault spatial coordinate system. If you do not specify a coordinate system, then by defaultbwselect3uses the intrinsic coordinate system in whichyis [1,size(J,1)].

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Worldz-axis coordinates, specified as a numeric scalar or numeric vector of the same length asxandy。Usex,y, andzto establish a nondefault spatial coordinate system. If you do not specify a coordinate system, then by defaultbwselect3uses the intrinsic coordinate system in whichzis [1,size(J,3)].

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

x-coordinates of voxels in the world coordinate system, specified as a numeric scalar or numeric vector.

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

y-coordinates of voxels in the world coordinate system, specified as a numeric scalar or numeric vector.

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

z-coordinates of voxels in the world coordinate system, specified as a numeric scalar or numeric vector.

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Output Arguments

collapse all

Binary volume containing objects that overlap specified voxels, returned as a 3-D logical array.Jcontains the set of objects overlapping with any of the voxels specified byr,c, andp, orxi,yi, andzi

Linear indices of the voxels belonging to the selected objects, returned as a numeric vector.

Version History

Introduced in R2017b