Hi,
In a plugin for MITK I create several models (vtkPolyData) on the go and I
want to reinitialize the views when I created a new instance of a MITK
surface. For this I tried to use following code, which I found at several
places in the source code:
mitk::NodePredicateNOT::Pointer pred
=
mitk::NodePredicateNOT::New(mitk::NodePredicateProperty::New("includeInBoundingBox"
, mitk::BoolProperty::New(false)));
mitk::DataStorage::SetOfObjects::ConstPointer rs =
this->GetDefaultDataStorage()->GetSubset(pred);
mitk::TimeSlicedGeometry::Pointer bounds =
this->GetDefaultDataStorage()->ComputeBoundingGeometry3D(rs);
mitk::RenderingManager::GetInstance()->InitializeViews(bounds);
Unfortunately this code does not change the number of slices, the size of
the slice navigator or the view. Also the slices are wrong
or insufficient to scroll through the details of the models. I tried to
print out the bounds of my polydata and the one that has been calculated by
the DataStorage and it looks like this:
14.65, 86.76, -199.68, -13.57, 73.54, 159.70
-1.00, 1.00, -1.00, 1.00, -1.00, 1.00
32.74, -19.66, 80.83
71.40, -19.66, 80.83
32.74, -15.28, 80.83
71.40, -15.28, 80.83
32.74, -19.66, 107.51
71.40, -19.66, 107.51
32.74, -15.28, 107.51
71.40, -15.28, 107.51
The first two lines indicate the bounds of the models in the DataStorage
while the rest is a list of the corner points of the calculated bounding
box.
The code that leads to this output looks like that:
for (mitk::DataStorage::SetOfObjects::ConstIterator it = rs->Begin(); it !=
rs->End(); it++)
{
mitk::Surface* surface =
reinterpret_cast<mitk::Surface*>(it->Value()->GetData());
if (surface)
{
vtkPolyData* poly = surface->GetVtkPolyData();
double bounds[6];
poly->GetBounds(bounds);
std::cout << bounds[0] << ", " << bounds[1] << ", " << bounds[2] << ", " <<
bounds[3] << ", " << bounds[4] << ", " << bounds[5] << std::endl;
}
}
std::cout << bounds->GetCornerPoint()[0] << ", " <<
bounds->GetCornerPoint()[1] << ", " << bounds->GetCornerPoint()[2] <<
std::endl;
std::cout << bounds->GetCornerPoint(false)[0] << ", " <<
bounds->GetCornerPoint(false)[1] << ", " << bounds->GetCornerPoint(false)[2]
<< std::endl;
std::cout << bounds->GetCornerPoint(true, false)[0] << ", " <<
bounds->GetCornerPoint(true, false)[1] << ", " <<
bounds->GetCornerPoint(true, false)[2] << std::endl;
std::cout << bounds->GetCornerPoint(false, false)[0] << ", " <<
bounds->GetCornerPoint(false, false)[1] << ", " <<
bounds->GetCornerPoint(false, false)[2] << std::endl;
std::cout << bounds->GetCornerPoint(true, true, false)[0] << ", " <<
bounds->GetCornerPoint(true, true, false)[1] << ", " <<
bounds->GetCornerPoint(true, true, false)[2] << std::endl;
std::cout << bounds->GetCornerPoint(false, true, false)[0] << ", " <<
bounds->GetCornerPoint(false, true, false)[1] << ", " <<
bounds->GetCornerPoint(false, true, false)[2] << std::endl;
std::cout << bounds->GetCornerPoint(true, false, false)[0] << ", " <<
bounds->GetCornerPoint(true, false, false)[1] << ", " <<
bounds->GetCornerPoint(true, false, false)[2] << std::endl;
std::cout << bounds->GetCornerPoint(false, false, false)[0] << ", " <<
bounds->GetCornerPoint(false, false, false)[1] << ", " <<
bounds->GetCornerPoint(false, false, false)[2] << std::endl;
Since the code I'm using is copied from other places in MITK I concluded
that something has to be wrong with my models. Can you help me to find a
way to properly set up my models so the above code initializes the view and
slice navigator properly? I think it has something to do with the sliced
geometry.
I can also provide I picture of the MultiWidget to illustrate the problem,
if needed.
Thanks in advance for your help,
Benjamin
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users