Re: [mitk-users] PlaneGeometry
Brought to you by:
mitk
|
From: Ivo W. <i....@dk...> - 2007-10-18 17:15:22
|
Hi Marcel,
could you please try to call SlicedGeometry3D::SetEvenlySpaced(false)?
I fear the default is m_EvenlySpaced = true ...
Best regards,
Ivo
> the current SVN version does not have that problem anymore. My
> applications works fine now as long as I only use a single slice.
>
> I went for multiple slices and encoutered another problem. As to be
> seen in the attached code I set up the SlicedGeometry3D as you told me
> to (at least I think I did the same). When I view the planes in the 3D
> view they are all at the expected position. But when I view the actual
> content of the slices (scroll through the images) it seems to behave
> like if I used a InitializeEvenlySpaced() call with the first plane as
> the Geometry2D. Another strange thing: I can call Initialize(50) and
> only set up say 10 PlaneGeometries and it still cycles through 50 slices.
>
> > mitk::SlicedGeometry3D::Pointer tSlicedGeometry =
> > mitk::SlicedGeometry3D::New();
> >
> > const unsigned int tNumberOfSlices = 50;
> > tSlicedGeometry->Initialize(tNumberOfSlices);
> > for (int i=0; i<tNumberOfSlices; i++)
> > {
> > mitk::PlaneGeometry::Pointer tPlaneGeometry =
> > mitk::PlaneGeometry::New();
> >
> > // setup plane (each one on a different distance from the source)
> > // ...
> >
> > tPlaneGeometry->InitializeStandardPlane(
> > tSliceX_MM,tSliceY_MM,tTransfRight,tTransfDown);
> > tPlaneGeometry->SetOrigin(tTransfOrigin);
> >
> > tSlicedGeometry->SetGeometry2D(tPlaneGeometry,i);
> > m_RegistrationGeometries.push_back(tPlaneGeometry);
> > }
> >
> > mitk::SliceNavigationController::Pointer tController =
> > m_RegistrationWidget->mitkWidget1->GetSliceNavigationController();
> >
> > tController->SetInputWorldGeometry(tSlicedGeometry);
> >
> > tController->SetViewDirection(
> > mitk::SliceNavigationController::Original);
> > tController->Update();
> >
> > // set visibility
> > mitk::DataTreeNode::Pointer tVolumeNode =
> > CommonFunctionality::GetFirstNodeByProperty(
> > this->GetDataTreeIterator(),"name",
> > new mitk::StringProperty(NAME_VOLIMAGE));
> > tVolumeNode->SetVisibility(true,
> > m_RegistrationWidget->GetRenderWindow1()->GetRenderer());
> >
> > m_RegistrationWidget->Fit();
> > m_RegistrationWidget->ForceImmediateUpdate();
>
> Any idea what is going on here or what I did wrong?
>
> Cheers,
>
> Marcel
>
>
>
>
>
>
> Ivo Wolf schrieb:
>> Hi Marcel,
>> that is strange. You seem to work with the rather old 0.6 version.
>> Could you please try the SVN version?
>> Best regards,
>> Ivo
>>
>> Marcel Schenderlein schrieb:
>>> Hi Ivo,
>>>
>>>> sorry, I do not have the time to reproduce the problem today.
>>> I am glad you are spending a little bit of time, so don't mind.
>>>
>>> I fixed the size problem (SetBounds) and it seems to work now. The
>>> problem I have now is that just after refreshing the display the
>>> application crashes with the following message:
>>>
>>> "Debug Error!
>>>
>>> Program: ...
>>> Module: ..BUILD\App\debug\MITKApplication.exe
>>> File:
>>> ...\src\mitk-0.6\interactions\mitkbaseinteraction\mitkglobalinteraction.cpp
>>>
>>>
>>> Line: 140
>>>
>>> Run-Time check Failure #0 - The value of ESP was not properly saved
>>> across ad function call. This is usually a result of calling a
>>> function declared with one calling convention with a function pointer
>>> declared with a different calling convention."
>>>
>>>
>>> I am off for holiday until next week so I won't reply until then.
>>>
>>> Thanks for any help so far!
>>>
>>> Best regards,
>>>
>>> Marcel
>>>
>>>
>>>> Two guesses:
>>>> 1) Do you see the plane of widget1 without your reslice-code
>>>> (before you change the geometry)?
>>>> Otherwise the node of the widget may not be in the tree. Add it
>>>> using
>>>> it->Add(widget1->GetCurrentWorldGeometry2DNode());
>>>> with "it" being an iterator to the tree.
>>>>
>>>> 2) mitk::PlaneGeometry::InitializePlane does not initialize the
>>>> actual size (and orientation) of the plane (i.e., uses a default
>>>> size).
>>>> Maybe the size is simply too small. So maybe try one of the
>>>> InitializeStandardPlane methods.
>>>>
>>>> Best regards,
>>>>
>>>> Ivo
>>>>
>>>>
>>>> Marcel Schenderlein schrieb:
>>>>> Hi Ivo,
>>>>>
>>>>> thanks for the extensive example.
>>>>>
>>>>> Unfortunately I am still not lucky with the PlaneGeometry. My goal
>>>>> is to have an arbitrary slice (I do not need several slices at the
>>>>> moment) and a 2D view of it.
>>>>> That is what I did:
>>>>>
>>>>> m_RegistrationGeometry = mitk::PlaneGeometry::New();
>>>>> mitk::Point3D tOrigin;
>>>>> tOrigin[0] = 0.0;
>>>>> tOrigin[1] = 0.0;
>>>>> tOrigin[2] = 0.0;
>>>>> mitk::Vector3D tNormal;
>>>>> tNormal[0] = 1.0;
>>>>> tNormal[1] = 1.0;
>>>>> tNormal[2] = 0.0;
>>>>> m_RegistrationGeometry->InitializePlane(tOrigin,tNormal);
>>>>>
>>>>> mitk::SlicedGeometry3D::Pointer tSlicedGeometry =
>>>>> mitk::SlicedGeometry3D::New();
>>>>> tSlicedGeometry->Initialize(1);
>>>>> tSlicedGeometry->SetGeometry2D(m_RegistrationGeometry,0);
>>>>>
>>>>> mitk::SliceNavigationController::Pointer tController =
>>>>> m_MultiWidget->mitkWidget1->GetSliceNavigationController();
>>>>>
>>>>> tController->SetInputWorldGeometry(tSlicedGeometry);
>>>>> tController->SetViewDirection(mitk::SliceNavigationController::Original);
>>>>>
>>>>>
>>>>> tController->Update();
>>>>>
>>>>> // make the volume visible
>>>>> mitk::DataTreeNode::Pointer tVolumeNode =
>>>>> CommonFunctionality::GetFirstNodeByProperty(
>>>>> this->GetDataTreeIterator(),"name",
>>>>> new mitk::StringProperty(NAME_VOLIMAGE));
>>>>>
>>>>> tVolumeNode->SetVisibility(true,m_MultiWidget->GetRenderWindow1()->GetRenderer());
>>>>>
>>>>>
>>>>>
>>>>> m_MultiWidget->ForceImmediateUpdate();
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Thanks for any help!
>>>>>
>>>>> Regards, Marcel
>>>>>
>>>>>
>>>>> Ivo Wolf schrieb:
>>>>>
>>>>>> Hi Marcel,
>>>>>>
>>>>>> first we need to construct the Geometry-objects representing the
>>>>>> planes
>>>>>> perpendicular to the vessel-centerline, i.e. instances of
>>>>>> mitk::PlaneGeometry.
>>>>>> There are several InitializeStandardPlane(...) methods to do
>>>>>> that, see
>>>>>> http://www.mitk.org/documentation/doxygen/classmitk_1_1PlaneGeometry.html
>>>>>>
>>>>>>
>>>>>>
>>>>>> Next we can put this set of instances of mitk::PlaneGeometry into an
>>>>>> mitk::SlicedGeometry3D:
>>>>>>
>>>>>> mitk::SlicedGeometry3D::Pointer
>>>>>> slicedGeometry = mitk::SlicedGeometry3D::New();
>>>>>> slicedGeometry->Initialize(numberOfCreated2Dplanes);
>>>>>> for(i=0;i<numberOfCreated2Dplanes;++i)
>>>>>> slicedGeometry->SetGeometry2D(aPlaneGeometry, i);
>>>>>>
>>>>>> Finally, we need to access the mitk::SliceNavigationController
>>>>>> (rendering controller)
>>>>>> of a widget, e.g. the bottom-left view, and tell it to use that
>>>>>> SlicedGeometry3D:
>>>>>>
>>>>>> //access the rendering-controller
>>>>>> mitk::SliceNavigationController::Pointer
>>>>>> crossSectionController =
>>>>>> multiWidget->mitkWidget4->GetSliceNavigationController();
>>>>>> //tell it to use the instance slicedGeometry
>>>>>> crossSectionController->SetInputWorldGeometry(slicedGeometry);
>>>>>> //tell it to use the PlaneGeometry instances within the
>>>>>> slicedGeometry
>>>>>> as they are provided
>>>>>> crossSectionController->SetViewDirection(mitk::SliceNavigationController::Original);
>>>>>>
>>>>>>
>>>>>> //tell it to update
>>>>>> crossSectionController->Update();
>>>>>>
>>>>>> That's it. Well, except that you need a data structure for
>>>>>> describing a
>>>>>> vessel and
>>>>>> creating out of these data the information required by
>>>>>> mitk::PlaneGeometry::InitializeStandardPlane.
>>>>>>
>>>>>> If you store the vessel in an mitk::Mesh, you can use the
>>>>>> mitk::PlanesPerpendicularToLinesFilter for this purpose, see
>>>>>> http://www.mitk.org/documentation/doxygen/classmitk_1_1PlanesPerpendicularToLinesFilter.html
>>>>>>
>>>>>>
>>>>>>
>>>>>> The output of that filter can be used as input for
>>>>>> SetInputWorldGeometry of
>>>>>> mitk::SliceNavigationController:
>>>>>> crossSectionController->SetInputWorldGeometry(
>>>>>> planesPerpendicularToLinesFilter->GetOutput()->GetGeometry());
>>>>>>
>>>>>> No guarantees for that filter, it is not fully developed.
>>>>>>
>>>>>> Best regards,
>>>>>>
>>>>>> Ivo
>>>>>>
>>>>>> Marcel Schenderlein schrieb:
>>>>>>
>>>>>>> Hi list,
>>>>>>>
>>>>>>> could anybody please translate the following citation from the
>>>>>>> MITK paper into a code example for me?
>>>>>>>
>>>>>>> "To realize the reslicing with MITK, only "Geometry-objects,
>>>>>>> representing rectangles perpendicular to the centerline of the
>>>>>>> vessels, had to be calculated, added to the data tree (...) and
>>>>>>> passed to a rendering controller that controls the bottom-left
>>>>>>> view to get the actual resliced image in that view."
>>>>>>>
>>>>>>> Cheers,
>>>>>>>
>>>>>>> Marcel
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>> -------------------------------------------------------------------------
>>>>>
>>>>>
>>>>> This SF.net email is sponsored by: Microsoft
>>>>> Defy all challenges. Microsoft(R) Visual Studio 2005.
>>>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>>>>> _______________________________________________
>>>>> mitk-users mailing list
>>>>> mit...@li...
>>>>> https://lists.sourceforge.net/lists/listinfo/mitk-users
>>>>>
>>>>
>>
>>
>
--
----------------------------------------------------------------------
Dr. Ivo Wolf, Dipl.-Phys. Phone: (+49) 6221/42-2327
Deutsches Krebsforschungszentrum Fax: (+49) 6221/42-2345
Div. Medical and Biological Informatics (E130)
Im Neuenheimer Feld 280 email: i....@dk...
D-69120 Heidelberg, Germany http://mbi.dkfz-heidelberg.de
----------------------------------------------------------------------
|