Andreas,

Thank you for your anwser, The solution in WriteBackSegmentationResult is
great if you PlaneGeometry is aligned with the current axis. However, this
is not my case.

I define my PlaneGeometry from a T-shaped targed placed in the sagittal
view [1]. The plane you see is created using

        mitk::Point3D p1 = figure->GetWorldControlPoint(0);
        mitk::Point3D p2 = figure->GetWorldControlPoint(1);
        mitk::Point3D center2D = figure->GetWorldControlPoint(2);

        //1.1 Setup direction vectors
        mitk::Vector3D rightToCenter = p2 - p1;
        mitk::Vector3D centerToTop = p1 - center2D;
        centerToTop.Normalize();
        rightToCenter.Normalize();

        mitk::Vector3D down = itk::CrossProduct(centerToRight,
          centerToTop);
        down.Normalize();

        //1.2 Initialize the planes
        mitk::PlaneGeometry::Pointer cutterPlaneTopRight =
          mitk::PlaneGeometry::New();

        cutterPlaneTopRight->InitializeStandardPlane(rightToCenter,
          down, &image->GetGeometry()->GetSpacing());
        cutterPlaneTopRight->SetOrigin(p1);
        cutterPlaneTopRight->SetBounds(image->GetGeometry()->GetBounds());


 where center2D is the top-most point in the image, p2 is the right-most
point and p1 is the intersection point of the T. As you can see, the plane
creation works just fine. The plane creation also works if the target is
rotated [2].

However, if the axis of the volume are rotated, the plane has holes in it
[3] even if the target itself is not rotated. The plane creation is done
using

        mitk::ExtractSliceFilter::Pointer slicer =
          mitk::ExtractSliceFilter::New();
        slicer->SetInput(image);
        slicer->SetWorldGeometry(cutterPlaneTopRight);
        slicer->SetVtkOutputRequest(true);
        slicer->Modified();
        slicer->Update();

        vtkSmartPointer<vtkImageData> sliceTopRight =
          vtkSmartPointer<vtkImageData>::New();
        sliceTopRight = slicer->GetVtkOutput();

        int* dims = sliceTopRight->GetDimensions();
        for (int z = 0; z < dims[2]; ++z)
        {
          for (int y = 0; y < dims[1]; ++y)
          {
            for (int x = 0; x < dims[0]; ++x)
            {
              sliceTopRight->SetScalarComponentFromDouble(x,y,z,0,1.0);
            }
          }
        }

        vtkSmartPointer<mitkVtkImageOverwrite> resliceIdx =
          vtkSmartPointer<mitkVtkImageOverwrite>::New();
        resliceIdx->SetOverwriteMode(true);
        resliceIdx->SetInputSlice(sliceTopRight);
        resliceIdx->Modified();

        mitk::ExtractSliceFilter::Pointer overwriter =
          mitk::ExtractSliceFilter::New(resliceIdx);
        overwriter->SetInput(image);
        overwriter->SetWorldGeometry(cutterPlaneTopRight);
        overwriter->SetVtkOutputRequest(true);
        overwriter->Modified();
        overwriter->Update();

  [1]: http://imgur.com/RPTo2
  [2]: http://imgur.com/JXFyx
  [3]: http://imgur.com/j05lH

Regards,
-F


On Mon, Jan 14, 2013 at 3:43 AM, Fetzer, Andreas <
[email protected]> wrote:

> Hi Felix,
>
> how do you get the PlaneGeometry which is set for writing the slice? You
> should retrieve the according PlaneGeometry like it is done e.g. in the
> mitkSegTool2D::WriteBackSegmentationResult. If this doesn't solve your
> problem it would be helpful if you could post your code here.
>
> Regards
> Andreas
>
> On 11.01.2013, at 21:15, Félix C. Morency wrote:
>
> > Hi list,
> >
> > I am trying to overwrite a slice of arbitrary orientation in a volume
> and I'm facing some issues. I based my code on the
> mitkOverwriteSliceFilterObliquePlaneTest. When my axis planes are oriented
> by default (axial/coronal/sagittal), everything's going fine and the slice
> is written properly [1].
> >
> > However, if I change the plane orientations using the coupled crosshair
> rotation tool, my slice is full of holes [2]. I tried playing with
> SetInPlaneResampleExtentByGeometry and with SetResliceTransformByGeometry
> without any luck. My initial guess is that it has something to do with
> slice sampling and current geometry. Does anyone have a clue on how to
> solve my problem? The objective is to fill the entire slice with the same
> value.
> >
> >   [1]: http://imgur.com/Ru4Nm
> >   [2]: http://imgur.com/FzCwx
> >
> > Regards,
> > --
> > Félix C. Morency, M.Sc.
> > Plateforme d’analyse et de visualisation d’images
> > Centre Hospitalier Universitaire de Sherbrooke
> > Centre de recherche clinique Étienne-Le Bel
> > Local Z5-3031 | 819.346.1110 ext 16634
> >
> ------------------------------------------------------------------------------
> > Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
> > much more. Get web development skills now with LearnDevNow -
> > 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
> > SALE $99.99 this month only -- learn more at:
> >
> http://p.sf.net/sfu/learnmore_122812_______________________________________________
> > mitk-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/mitk-users
>
>


-- 
-- 
Félix C. Morency, M.Sc.
Plateforme d’analyse et de visualisation d’images
Centre Hospitalier Universitaire de Sherbrooke
Centre de recherche clinique Étienne-Le Bel
Local Z5-3031 | 819.346.1110 ext 16634
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to