The SEARCH3D function finds "objects" or regions of similar data values within a 3D array of data. Given a starting location and a range of values to search for, SEARCH3D finds all the cells within the volume that are within the specified range of values and have some path of connectivity through these cells to the starting location. In addition to searching for cells within a global range of data values, SEARCH3D can also search for adjacent cells whose values deviate from their neighbors within specified tolerances.
SEARCH3D returns a longword array that contains a list of the array subscripts that define the selected object or region. The original X and Y indices of the array subscripts returned by SEARCH3D can be found with the following IDL code:
index_z = Result / (S[1] * S[2])
index_y = ( Result - (index_z * S[1] * S[2])) / S[1]
index_x = ( Result - (index_z * S[1] * S[2])) - (index_y * S[1])
where
Result
is the array returned by SEARCH3D and
Array
is the original input volume. The object within
Array
can be subscripted as
Array[Region]
or
Array[index_x, index_y, index_z]
.
This routine is written in the IDL language. Its source code can be found in the file
search3d.pro
in the
lib
subdirectory of the IDL distribution.
This keyword and the INCREASE keyword allow you to compensate for changing intensities of data values within an object. An edge-enhanced copy of Array is made and compared to the orginal array if this keyword is set. When DECREASE or INCREASE is set, any adjacent cells are found if their corresponding data values in the edge enhanced array are greater than DECREASE and less than INCREASE. In any case, the adjacent cells will never be selected if their data values are not between Min_Val and Max_Val . The default for this keyword is 0.0 if INCREASE is specified.
This keyword and the DECREASE keyword allow you to compensate for changing intensities of data values within an object. An edge-enhanced copy of Array is made and compared to the orginal array if this keyword is set. When DECREASE or INCREASE is set, any adjacent cells are found if their corresponding data values in the edge enhanced array are greater than DECREASE and less than INCREASE. In any case, the adjacent cells will never be selected if their data values are not between Min_Val and Max_Val . The default for this keyword is 0.0 if DECREASE is specified.
Set this keyword to an integer value of 3 or greater to perform low-pass filtering on the edge-enhanced array. The value of LPF_BAND is used as the width of the smoothing window. This keyword is only effective when the DECREASE or INCREASE keywords are also specified. The default is no smoothing.
Set this keyword to cause SEARCH3D to find cells meeting the search criteria whose surrounding cubes share a common corner or edge. Normally, cells are considered adjacent only when cubes surrounding the cells share a common edge. Setting this option requires more memory and execution time.
Find all the indices corresponding to an object contained in a 3D array:
vol = RANDOMU(s, 40, 40, 40) ; Create some data.
region = SEARCH3D(vol, 6, 22, 16, 1.2, 1.4, /DIAGONAL)
;
Search for an object starting at (6, 22, 16) whose data values are between (1.2) and (1.4).
vol = BYTSCL(vol, TOP=127B) ; Scale the background cells into the range 0 to 127.
vol[Region] = 255B ; Highlight the object region by setting it to 255.
WINDOW, 0, XSIZE=640, YSIZE=512, RETAIN=2
CREATE_VIEW, XMAX=39, YMAX=39, ZMAX=39, AX=(-30), AZ=30, ZOOM=0.8
S;
et up a 3-D view.
TVSCL, PROJECT_VOL(vol, 64, 64, 40, DEPTH_Q=0.4)
;
Display the volume with the highlighted object in it.