Hi Stefan, I checked an old post https://sourceforge.net/p/mitk/mailman/message/3457721/ and made a little change. Now I can almost get what I wanted, just the reslice on 3D view is across the whole geometry (as you said a new mapper is needed to get small size I guess). The current issue is if I add two planegeometries with different orientations into slicedgeometry, it still uses the first one to create a second as like evenlyspaced. If I add "SetEvenlySpaced(false)" for slicedgeometry, the application crashes at "sliceController->Update()" . The code is as below. I feel it's getting closer to my goal, but there are some very small issues I can't figure out. ======================= m_SliceWidget->GetRenderer()->SetDataStorage(this->GetDataStorage());
//create plane geometries mitk::PlaneGeometry::Pointer planegeometry = mitk::PlaneGeometry::New(); mitk::PlaneGeometry::Pointer planegeometry2 = mitk::PlaneGeometry::New(); mitk::Point3D origin,origin2; mitk::Vector3D right, bottom, bottom2; mitk::FillVector3D(origin, 0.0, 0.0, 0.0); mitk::FillVector3D(origin2, 0.0, 0.0, 0.0); mitk::FillVector3D(right, 1.0, 0,0.0); mitk::FillVector3D(bottom, 0, 1.0, 1.0); mitk::FillVector3D(bottom2, 0, 1.0, 0.0); planegeometry->InitializeStandardPlane(100,100, right.GetVnlVector(), bottom.GetVnlVector()); planegeometry->SetOrigin(origin); planegeometry2->InitializeStandardPlane(100,100, right.GetVnlVector(), bottom2.GetVnlVector()); planegeometry2->SetOrigin(origin2); mitk::SlicedGeometry3D::Pointer slicedGeo3D=mitk::SlicedGeometry3D::New(); //slicedGeo3D->SetEvenlySpaced(false); slicedGeo3D->InitializeSlicedGeometry(2); slicedGeo3D->SetPlaneGeometry(planegeometry,0); slicedGeo3D->SetPlaneGeometry(planegeometry2,1); slicedGeo3D->SetReferenceGeometry(image->GetTimeGeometry()->GetGeometryForTimeStep(0)); mitk::SliceNavigationController::Pointer sliceController=m_SliceWidget->GetSliceNavigationController(); sliceController->SetInputWorldGeometry3D(slicedGeo3D); sliceController->SetViewDirection(mitk::SliceNavigationController::Original); sliceController->Update(); GetDataStorage()->Add(m_SliceWidget->GetRenderer()->GetCurrentWorldPlaneGeometryNode()); ====================== Thanks, Hongzhi ________________________________________ From: Hongzhi Lan <hong...@stanford.edu> Sent: Thursday, March 24, 2016 7:37 PM To: Kislinskiy, Stefan; mitk-users@lists.sourceforge.net Subject: Re: [mitk-users] Showing an arbitrary reslice of 3D image in QmitkSliceWidget Thanks! I tried the measurementtoolbox plugin, but I got confused. For me, planar figures are just planar geometry. To create a planar figure, I need to first use planarfigure->SetPlaneGeometry( planeGeometry ), because control points are just Point2D. I don't understand how to use planar figure to show arbitrary reslice of 3D image in QmitkSliceWidget and 3D view in QmitkStdMultiWidget. My goal is to show a small reslice of 3D image along a vessle path in QmitkSliceWidget and 3D view window in QmitkStdMultiWidget; then in QmitkSliceWidget, create a 2D contour for the vessel cross section based on the reslice. I used the code below to create a planar figure, but nothing shows in QmitkSliceWidget and a rectangle does show in 3D view of QmitkStdMultiWidget. when I do reinit on this node, I can see the small slice in QmitkSliceWidget and the slice with the rectangle in 3D view of QmitkStdMultiWidget (see attachments). But I think the slice has nothing to do with planarfigure but use the planeGeometry to define the size and orienation, which is kind of similar as I used slicenavigationcontroller in my first email. Thanks, Hongzhi ============================ m_SliceWidget->SetDataStorage(dataStorage); mitk::PlaneGeometry::Pointer planeGeometry = mitk::PlaneGeometry::New(); planeGeometry->InitializeStandardPlane( 100.0, 100.0 ); mitk::Point2D p0; p0[0] = 20.0; p0[1] = 20.0; mitk::Point2D p1; p1[0] = 80.0; p1[1] = 80.0; mitk::PlanarRectangle::Pointer planarRectangle = mitk::PlanarRectangle::New(); planarRectangle->SetPlaneGeometry( planeGeometry ); planarRectangle->PlaceFigure( p0 ); planarRectangle->SetCurrentControlPoint( p1 ); planarRectangle->GetPropertyList()->SetBoolProperty( "initiallyplaced", true ); auto rect = mitk::PlanarRectangle::New(); rect->SetPlaneGeometry( planeGeometry ); rect->PlaceFigure(p0); rect->SetCurrentControlPoint( p1); rect->GetPropertyList()->SetBoolProperty( "initiallyplaced", true ); rect->Modified(); mitk::DataNode::Pointer newNode= mitk::DataNode::New(); newNode->SetName("planarrect"); newNode->SetData(rect); newNode->SetBoolProperty("planarfigure.3drendering", true); GetDataStorage()->Add(newNode); ________________________________________ From: Kislinskiy, Stefan <s.kislins...@dkfz-heidelberg.de> Sent: Thursday, March 24, 2016 2:27 AM To: Hongzhi Lan; mitk-users@lists.sourceforge.net Subject: AW: [mitk-users] Showing an arbitrary reslice of 3D image in QmitkSliceWidget Switch on the measurementtoolbox plugin in CMake, configure, generate, build, and run the Workbech. Open the Measurement View [1], which allows you to draw different kinds of planar figures. There you can get a good idea of planar figures. You can place them programmatically, too. See a few tests in the PlanarFigure module or the following example snippet which should places a PlanarLine (point variables are of type Point3D): auto line = mitk::PlanarLine::New(); line->PlaceFigure(firstPoint); line->SetControlPoint(1, secondPoint); line->Modified(); To see something, you must put the planar figure into a DataNode and add the DataNode to the DataStorage of course. Planar figures are only drawn in the 2D windows. To show them in the 3D window as well, you must set the planarfigure.3drendering Property to true for your planar figure. [1] http://docs.mitk.org/2015.05/org_mitk_views_measurement.html ________________________________________ Von: Hongzhi Lan [hong...@stanford.edu] Gesendet: Donnerstag, 24. März 2016 06:11 An: Kislinskiy, Stefan; mitk-users@lists.sourceforge.net Betreff: Re: [mitk-users] Showing an arbitrary reslice of 3D image in QmitkSliceWidget Also, yes, the use is only segmenting in this extra 2D window, but I still want to show the slice on 3D View window of QmitkStdMultiWidget to tell the use where the slice is located in the 3D image. Thanks, Hongzhi ________________________________________ From: Hongzhi Lan <hong...@stanford.edu> Sent: Wednesday, March 23, 2016 10:02 PM To: Kislinskiy, Stefan; mitk-users@lists.sourceforge.net Subject: Re: [mitk-users] Showing an arbitrary reslice of 3D image in QmitkSliceWidget Thank you so much for your suggestions, but I don't have any clue about how to use Planar Figures or the camera to achieve what I want. I tried to find some example code in MITK source about planar figures, but I didn't find any that can help my work. Could you give me some examples or links to me? I really appreciate it! Best, Hongzhi ________________________________________ From: Kislinskiy, Stefan <s.kislins...@dkfz-heidelberg.de> Sent: Wednesday, March 23, 2016 9:22 PM To: Hongzhi Lan; mitk-users@lists.sourceforge.net Subject: AW: [mitk-users] Showing an arbitrary reslice of 3D image in QmitkSliceWidget In your case I don't see the necessity for a cropped rendering of the perpendicular slices. Hence, I would *not* recommend to write your own mappers, as this is rather complicated and I don't see a huge advantage compared to using planar figures for user guidance which would justify the amount of work. As an alternative, you could also work with the camera of your extra 2D window to focus on the vessel in that window, as it seems like the user is segmenting only in this window anyways. Please also note that we integrated the Vascular Modeling Toolkit into our superbuild (MITK_USE_VMTK), which may be of help to you for what you are trying to achieve. Best regards, Stefan ________________________________________ Von: Hongzhi Lan [hong...@stanford.edu] Gesendet: Mittwoch, 23. März 2016 20:30 An: Kislinskiy, Stefan; mitk-users@lists.sourceforge.net Betreff: Re: [mitk-users] Showing an arbitrary reslice of 3D image in QmitkSliceWidget My application is to create a path(centerline) for a vessel, and show small reslices perpendicular to the path at QmitkSliceWidget. Then, next step is to to create a group of 2D contours(segmentation) using those reslices by hand or level set to define vessel shape at each cross sections (see attachment) . Finally I use the group of 2D contours to create a polydata surface for the whole vessel. This is what I want to achieve. Do you think specialized mappers are the best option for my need? Or do you have some other suggestions? Thanks a lot! Hongzhi ________________________________ From: Kislinskiy, Stefan <s.kislins...@dkfz-heidelberg.de> Sent: Wednesday, March 23, 2016 5:38 AM To: Hongzhi Lan; mitk-users@lists.sourceforge.net Subject: RE: [mitk-users] Showing an arbitrary reslice of 3D image in QmitkSliceWidget Yes, providing specialized mappers for your intended use case is one solution. The question is what you want to achieve? Why are you using the extra slice? Do you want to show the user something on that slice? Then maybe it is okay to live with the current solution but as a workaround display a PlanarFigure on top of your extra slice to emphasize the region of interest in the extra slice? From: Hongzhi Lan [mailto:hong...@stanford.edu] Sent: Mittwoch, 23. März 2016 11:34 To: Kislinskiy, Stefan; mitk-users@lists.sourceforge.net Subject: Re: [mitk-users] Showing an arbitrary reslice of 3D image in QmitkSliceWidget Thanks! You mean, for PlaneGeometry I may need to write alternatives for PlaneGeometryDataMapper2D and PlaneGeometryDataVtkMapper3D? If using PlanarFigure, can I show an arbitrary reslice of 3D image in both QmitkSliceWidget and 3D view in QmitkStdMultiWidget? Are there any examples about how to use PlanarFigure to do this? Thanks, Hongzhi ________________________________ From: Kislinskiy, Stefan <s.kislins...@dkfz-heidelberg.de<mailto:s.kislins...@dkfz-heidelberg.de>> Sent: Tuesday, March 22, 2016 4:17 AM To: Hongzhi Lan; mitk-users@lists.sourceforge.net<mailto:mitk-users@lists.sourceforge.net> Subject: RE: [mitk-users] Showing an arbitrary reslice of 3D image in QmitkSliceWidget Hi Hongzhi, the size/geometry of the slice is fine (you can check this by Reinit on the slice in the Data Manager. However, the standard PlaneGeometry mappers do not work as you may expect. They use the reference geometry bounds or the world bounds to cut the planes in shape. You could try to write your own PlaneGeometry mapper(s) for your PlaneGeometry node or try a different approach which requires less work, e.g., use a rectangular PlanarFigure to highlight the ROI in your image slice. Best, Stefan From: Hongzhi Lan [mailto:hong...@stanford.edu] Sent: Dienstag, 22. März 2016 07:55 To: mitk-users@lists.sourceforge.net<mailto:mitk-users@lists.sourceforge.net> Subject: [mitk-users] Showing an arbitrary reslice of 3D image in QmitkSliceWidget Hello everyone, I'm tring to show an arbitrary reslice of 3D image in QmitkSliceWidget and also 3D view in QmitkStdMultiWidget at the same time. The orientation of the reslice looks fine, but in QmitkSliceWidget and 3D view QmitkStdMultiWidget the sizes are not right (see the attachments). It should be a small square(40x40) (see the source code below). I really need some help on thie issue. I'm using MITK 2015.05.2 and Ubuntu 14. Thanks! Hongzhi The code is as below: ====================== QmitkSliceWidget* m_SliceWidget=new QmitkSliceWidget(parent); m_SliceWidget->SetDataStorage(dataStorage); mitk::PlaneGeometry::Pointer planegeometry = mitk::PlaneGeometry::New(); mitk::Point3D origin; mitk::Vector3D right, bottom, normal; mitk::FillVector3D(origin, 1.0, 1.0, 1.0); mitk::FillVector3D(right, 1.0, 0, 0); mitk::FillVector3D(bottom, 0, 1.0, 1.0); planegeometry->InitializeStandardPlane(40,40, right.GetVnlVector(), bottom.GetVnlVector()); planegeometry->SetOrigin(origin); mitk::SlicedGeometry3D::Pointer slicedGeo3D=mitk::SlicedGeometry3D::New(); slicedGeo3D->InitializeSlicedGeometry(1); slicedGeo3D->SetPlaneGeometry(planegeometry,0); slicedGeo3D->SetReferenceGeometry(node_image3D->GetData()->GetTimeGeometry()->GetGeometryForTimeStep(0)); m_SliceWidget->GetSliceNavigationController()->SetInputWorldGeometry3D(slicedGeo3D); m_SliceWidget->GetSliceNavigationController()->SetViewDirection(mitk::SliceNavigationController::Original); m_SliceWidget->GetSliceNavigationController()->Update(); GetDataStorage()->Add(m_SliceWidget->GetRenderer()->GetCurrentWorldPlaneGeometryNode()); ------------------------------------------------------------------------------ Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more. http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140 _______________________________________________ mitk-users mailing list mitk-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mitk-users ------------------------------------------------------------------------------ Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more. http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140 _______________________________________________ mitk-users mailing list mitk-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mitk-users