Skip to content

Commit

Permalink
Added methods to query volumes dimensions, voxel count and resolution.
Browse files Browse the repository at this point in the history
  • Loading branch information
adnanmunawar committed Jan 24, 2022
1 parent 08511ae commit c654ff4
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
40 changes: 40 additions & 0 deletions ambf_framework/afFramework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9023,6 +9023,46 @@ cVoxelObject* afVolume::getInternalVolume(){
}


///
/// \brief afVolume::getDimensions
/// \return
///
cVector3d afVolume::getDimensions()
{
cVector3d dim = m_voxelObject->m_maxCorner - m_voxelObject->m_minCorner;
return dim;
}


///
/// \brief afVolume::getVoxelCount
/// \return
///
cVector3d afVolume::getVoxelCount()
{
cVector3d count;
count(0) = m_voxelObject->m_texture->m_image->getWidth();
count(1) = m_voxelObject->m_texture->m_image->getHeight();
count(2) = m_voxelObject->m_texture->m_image->getImageCount();
return count;
}

///
/// \brief afVolume::getResolution
/// \return
///
cVector3d afVolume::getResolution()
{
cVector3d count = getVoxelCount();
cVector3d dims = getDimensions();
cVector3d res;
res(0) = dims(0) / count(0);
res(1) = dims(1) / count(1);
res(2) = dims(2) / count(2);
return res;
}


///
/// \brief afVolume::backupTexture
///
Expand Down
6 changes: 6 additions & 0 deletions ambf_framework/afFramework.h
Original file line number Diff line number Diff line change
Expand Up @@ -2533,6 +2533,12 @@ class afVolume: public afBaseObject{

cVoxelObject* getInternalVolume();

cVector3d getDimensions();

cVector3d getVoxelCount();

cVector3d getResolution();

void backupTexture();

void restoreTexture();
Expand Down

0 comments on commit c654ff4

Please sign in to comment.