Hey Tobi,
Okay, I have found the problem: After setVtkPolyData I modify the
vtkPolyData of the surface without calling CalculateBoundingBox()
afterwards. Now calculating the bounding box and a "Global Reinit" fixes the
problem.
For the code example I gave I could to something 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)
{
surface->CalculateBoundingBox();
...
}
}
Now I have a small question: Is it possible to adjust the plane widgets
(number of slices and dimensions) without changing the zoom of the 3D view
in the StdMultiWidget? Now after I do a Global Reinit the view is reset to a
point where the whole scene can be looked at. Can I avoid this somehow?
Thanks for directing me in the right direction with the corrupted geometry.
Regards, Benjamin
On Thu, Aug 12, 2010 at 13:07, Schwarz Tobias <
[email protected]> wrote:
> Dear Benjamin,
>
>
>
> it seems like the geometry of your surface models is somehow corrupted.
>
> By the way, you can see the MITK bounding box also in DataManager if you
> right-click the surface and choose “Details”.
>
>
>
> Sorry, no other idea by now.
>
>
>
> Best,
>
> Tobi
>
>
>
> ------------------------------------------------------------
>
> Tobias Schwarz
> DKFZ
> German Cancer Research Center (Deutsches Krebsforschungszentrum)
> Member of the Helmholtz Association
> Division of Medical & Biological Informatics E130
> Im Neuenheimer Feld 280
> D-69120 Heidelberg
>
> Phone: 49-(0)6221-42-2353
> Fax: 49-(0)6221-42-2345
> E-Mail: [email protected]
> Web: www.dkfz.de
>
> Confidentiality Note: This message is intended only for the use of the
> named recipient(s) and may obtain confidential and/or privileged
> information. If you are not the intended recipient, please contact the
> sender and delete the message. Any unauthorized use of the information
> contained in this message is prohibited.
>
>
>
> *Von:* [email protected] [mailto:[email protected]] *Im Auftrag von
> *Benjamin Knecht
> *Gesendet:* Donnerstag, 12. August 2010 11:15
> *An:* Schwarz Tobias
> *Cc:* [email protected]
> *Betreff:* Re: [mitk-users] Initialize views (and sliced geometry?)
> properly
>
>
>
> Hi Tobi,
>
>
>
> yes, sorry I forgot to paste that last line. So I do update the Rendering.
>
>
>
> Check out this image. This should illustrate my problem:
>
> http://www.pasteall.org/pic/5107
>
>
>
> Regards, Benjamin
>
> On Wed, Aug 11, 2010 at 18:42, Schwarz Tobias <
> [email protected]> wrote:
>
> Dear Benjamin,
>
> stupid question: Have you tried to just update the Rendering?
>
> mitk::RenderingManager::GetInstance()->RequestUpdateAll();
>
> The newly added surface should be included automatically, while the updated
> BoundingBox is also calculated.
> Or do you wish to restrict your view to a specific area?
> As far as I remember, the number of slices should automatically be adapted
> to the size of your surfaces.
> There was a bug with extremly small surfaces, though. Not sure if it is
> resolved.
>
> Regards,
> Tobi
> ------------------------------------------------------------
> Tobias Schwarz
> DKFZ
> German Cancer Research Center (Deutsches Krebsforschungszentrum)
> Member of the Helmholtz Association
> Division of Medical & Biological Informatics E130
> Im Neuenheimer Feld 280
> D-69120 Heidelberg
> Phone: 49-(0)6221-42-2353
> Fax: 49-(0)6221-42-2345
> E-Mail: [email protected]<mailto:[email protected]>
> Web: http://www.dkfz.de/en/mbi/<
> https://dkfzowa0.dkfz-heidelberg.de/owa/redir.aspx?C=6ebb39f6c3b94e03a77eca6c5e2e87a9&URL=http%3a%2f%2fwww.dkfz.de%2fen%2fmbi%2f
> >
> Confidentiality Note: This message is intended only for the use of the
> named recipient(s) and may obtain confidential and/or privileged
> information. If you are not the intended recipient, please contact the
> sender and delete the message. Any unauthorized use of the information
> contained in this message is prohibited.
> ________________________________
> Von: Benjamin Knecht [[email protected]]
> Gesendet: Mittwoch, 11. August 2010 16:27
> An: [email protected]
> Betreff: [mitk-users] Initialize views (and sliced geometry?) properly
>
>
> 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