edu.unh.sdb.datasource
Class RayCellIterator

java.lang.Object
  extended by edu.unh.sdb.datasource.DataCollection
      extended by edu.unh.sdb.datasource.DataBlock
          extended by edu.unh.sdb.datasource.RayCellIterator
All Implemented Interfaces:
Indexable

public class RayCellIterator
extends DataBlock

This class simulates a ray passing througth a cubic index space. Assume that the distances between adjacent indexes are 1 ( unite length). this cell iterator is also a small cubic datablock containing 8 index 8 7 ------------- - _- - - - ------------ - - 4 3 - - 6 - - - - 1 2-- ------------ This iterator maintain two pieces of information 1. the current dataBlock 2. the ray intersection position within the block -------------------- Edit history as of 12/05/04 --------------------------- 12/05/04 rdb: deleted size(). inherits from DataCollection; it was a dummy anyway.


Field Summary
 
Fields inherited from class edu.unh.sdb.datasource.DataCollection
attributeOrder, axisOrdering, axisWeights, bounds, dataOrder, dimensionality, numAttributes, pointOrder, recordDesc
 
Constructor Summary
RayCellIterator(float startx, float starty, float startz, float dx, float dy, float dz, float step, Indexable source)
          construct the interator by giving voxel,starting point,ending point,concreteBlock
 
Method Summary
 void datum(Datum datum, IndexSpaceID id)
          Given an IndexSpaceID, copy the values of the Datum at that position to the argument Datum.
 void datum(Datum datum, IndexSpaceID id, FieldIDMapper mp)
          Given an IndexSpaceID and FieldIDMapper, copy the values of the Datum at that position to the argument Datum.
 void datum(Datum datum, IndexSpaceID id, RecordSpec spec)
          Given an IndexSpaceID and RecordSpec, copy the values of the Datum at that position to the argument Datum.
 void datum(Datum d, int[] coordArray)
          Given an array of coordinates, copy the corresponding datum into the first parameter.
 Datum datum(IndexSpaceID did)
          Given an IndexSpaceID, return the corresponding datum.
 Datum datum(IndexSpaceID did, RecordSpec spec)
          Given an IndexSpaceID, return the corresponding datum with attributes specified in the RecordSpec.
 ISBounds[] getEnumerWindow(int windowSize)
          get an array of ISBounds within the iteration enumeration window Enumeration window is the number of iteration steps that can be predicted in advance it's possible that two element in the array have the same ISBounds
 float[] getLocalIntersection()
           
 Values getValues()
          Returns the Values of the current DataBlock.
 boolean hasMoreElements()
          Return true if this ISIterator can be incremented.
 void init()
          initialize the itertor move to the first cell block which intersects with the ray, set default axisordering as {2,1,0}
 void init(AxisOrdering order)
          initialize the itertor move to the first cell block which intersects with the ray
 float[] interpolateValues()
          return interpolated values of all the attribute, stored in a array
 void next()
          move the iterator to the next possiton, and get the data from the source
 boolean nextBounds()
          return true if iterator moves to next spacial postion.
 void setDatum(IndexSpaceID isid, Datum d)
          Set the location specified by the IndexSpaceID to the given datum.
 void subblock(DataBlock theBlock, ISBounds dstBounds, ISBounds srcBounds)
          Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds.
 void subblock(DataBlock theBlock, ISBounds dstBounds, ISBounds srcBounds, FieldIDMapper mp)
          Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds.
 void subblock(DataBlock theBlock, ISBounds dstBounds, ISBounds srcBounds, RecordSpec spec)
          Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds.
 DataBlock subblock(ISBounds db)
          Return a new DataBlock that is a subset of this datablock.
 float triliner(float fx, float fy, float fz, float v000, float v100, float v110, float v010, float v001, float v101, float v111, float v011)
          trilinear interpolation.
 
Methods inherited from class edu.unh.sdb.datasource.DataBlock
setByAttribute, setByte, setBytes, setBytes, setBytesByAttribute, setBytesByPoint, setDouble, setDoubles, setDoubles, setDoublesByAttribute, setDoublesByPoint, setFloat, setFloats, setFloats, setFloatsByAttribute, setFloatsByPoint, setInt, setInts, setInts, setIntsByAttribute, setIntsByPoint, setShort, setShorts, setShorts, setShortsByAttribute, setShortsByPoint, setValues, setValues, setValuesByAttribute, setValuesByPoint, toString
 
Methods inherited from class edu.unh.sdb.datasource.DataCollection
byteSize, computeOffset, computeOffset, copyBounds, createDataBlock, createDataBlock, createDataBlock, createDatum, createDatum, createDatum, createDatum, createDatum, createDatum, datum, dim, getAxisOrdering, getAxisWeight, getAxisWeights, getBounds, getByte, getBytes, getBytes, getBytes, getBytes, getBytes, getBytes, getBytesByAttribute, getBytesByAttribute, getBytesByPoint, getBytesByPoint, getDataOrder, getDimensionsArray, getDouble, getDoubles, getDoubles, getDoubles, getDoubles, getDoubles, getDoubles, getDoublesByAttribute, getDoublesByAttribute, getDoublesByPoint, getDoublesByPoint, getFloat, getFloats, getFloats, getFloats, getFloats, getFloats, getFloats, getFloatsByAttribute, getFloatsByAttribute, getFloatsByPoint, getFloatsByPoint, getInt, getInts, getInts, getInts, getInts, getInts, getInts, getIntsByAttribute, getIntsByAttribute, getIntsByPoint, getIntsByPoint, getLowerBoundsArray, getNumAttributes, getRecordDescriptor, getShort, getShorts, getShorts, getShorts, getShorts, getShorts, getShorts, getShortsByAttribute, getShortsByAttribute, getShortsByPoint, getShortsByPoint, getStorageType, getValues, getValuesByAttribute, getValuesByPoint, longVolume, setAxisOrdering, setBounds, setRecordDescriptor, size, subblock, subblock, subblock, subblock, subblock, subblock, subblock, subblock, useBytesOnly, volume
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RayCellIterator

public RayCellIterator(float startx,
                       float starty,
                       float startz,
                       float dx,
                       float dy,
                       float dz,
                       float step,
                       Indexable source)
construct the interator by giving voxel,starting point,ending point,concreteBlock

Method Detail

init

public void init()
initialize the itertor move to the first cell block which intersects with the ray, set default axisordering as {2,1,0}


init

public void init(AxisOrdering order)
initialize the itertor move to the first cell block which intersects with the ray


hasMoreElements

public boolean hasMoreElements()
Return true if this ISIterator can be incremented. move to next ray sample location


next

public void next()
move the iterator to the next possiton, and get the data from the source


nextBounds

public boolean nextBounds()
return true if iterator moves to next spacial postion. return false if it stays where it is


getEnumerWindow

public ISBounds[] getEnumerWindow(int windowSize)
get an array of ISBounds within the iteration enumeration window Enumeration window is the number of iteration steps that can be predicted in advance it's possible that two element in the array have the same ISBounds


getLocalIntersection

public float[] getLocalIntersection()

datum

public Datum datum(IndexSpaceID did)
Given an IndexSpaceID, return the corresponding datum.

Specified by:
datum in interface Indexable
Overrides:
datum in class DataCollection

datum

public void datum(Datum d,
                  int[] coordArray)
Given an array of coordinates, copy the corresponding datum into the first parameter.

Overrides:
datum in class DataCollection

datum

public void datum(Datum datum,
                  IndexSpaceID id,
                  RecordSpec spec)
Description copied from class: DataCollection
Given an IndexSpaceID and RecordSpec, copy the values of the Datum at that position to the argument Datum. TODO Define error conditions Definition below as in DataSource. rdb: I thought RecordSpec "selected" fields from source, not from the destination. PBR: Return by reference the Datum corresponding to the given IndexSpaceID. Only datum fields referred to by the RecordSpec are modified.

Specified by:
datum in interface Indexable
Overrides:
datum in class DataCollection

datum

public void datum(Datum datum,
                  IndexSpaceID id,
                  FieldIDMapper mp)
Description copied from class: DataCollection
Given an IndexSpaceID and FieldIDMapper, copy the values of the Datum at that position to the argument Datum. TODO Define error conditions

Specified by:
datum in interface Indexable
Specified by:
datum in class DataCollection

datum

public void datum(Datum datum,
                  IndexSpaceID id)
Description copied from class: DataCollection
Given an IndexSpaceID, copy the values of the Datum at that position to the argument Datum. TODO Define error conditions

Specified by:
datum in interface Indexable
Overrides:
datum in class DataCollection

datum

public Datum datum(IndexSpaceID did,
                   RecordSpec spec)
Given an IndexSpaceID, return the corresponding datum with attributes specified in the RecordSpec.

Specified by:
datum in interface Indexable
Overrides:
datum in class DataCollection

setDatum

public void setDatum(IndexSpaceID isid,
                     Datum d)
Set the location specified by the IndexSpaceID to the given datum.

Specified by:
setDatum in class DataBlock

subblock

public DataBlock subblock(ISBounds db)
Return a new DataBlock that is a subset of this datablock. The Data is shared between the two DataBlocks.

Specified by:
subblock in interface Indexable
Overrides:
subblock in class DataCollection

subblock

public void subblock(DataBlock theBlock,
                     ISBounds dstBounds,
                     ISBounds srcBounds)
Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds.

Specified by:
subblock in interface Indexable
Specified by:
subblock in class DataCollection

subblock

public void subblock(DataBlock theBlock,
                     ISBounds dstBounds,
                     ISBounds srcBounds,
                     FieldIDMapper mp)
Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds. The FieldIDMapper argument determines the mapping between datums in this DataBlock and datums in the argument DataBlock.

Specified by:
subblock in interface Indexable
Specified by:
subblock in class DataCollection

subblock

public void subblock(DataBlock theBlock,
                     ISBounds dstBounds,
                     ISBounds srcBounds,
                     RecordSpec spec)
Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds. The RecordSpec argument specifies a subset of the attributes of this DataSource to be written into the DataBlock datums.

Specified by:
subblock in interface Indexable
Overrides:
subblock in class DataCollection

getValues

public Values getValues()
Returns the Values of the current DataBlock.

Overrides:
getValues in class DataBlock

interpolateValues

public float[] interpolateValues()
return interpolated values of all the attribute, stored in a array


triliner

public float triliner(float fx,
                      float fy,
                      float fz,
                      float v000,
                      float v100,
                      float v110,
                      float v010,
                      float v001,
                      float v101,
                      float v111,
                      float v011)
trilinear interpolation. Store 8 values in a array, first 4 values---front face start at 000,100,110,010, the last 4 values map to 001,101,111,011) fx,fy,fz : the fraction position between the two points vx00 = v000 + fx * (v100-v000) vx01 = v001 + fx * (v101-v001) vx10 = v010 + fx * (v110-v010) vx11 = v011 + fx * (v111-v011) vxy0 = vx00 + fx * (vx10 - vx00) vxy1 = vx01 + fx * (vx11 - vx01) vxyz = vxy0 + fz * (vxy1 - vxy0)