PerkLab / PolySeg

Library for polymorph segmentation representation for medical image computing
BSD 2-Clause "Simplified" License
20 stars 4 forks source link

Use this repository from 3D Slicer #2

Open cpinter opened 5 years ago

cpinter commented 5 years ago

Currently this library as used from within Slicer (https://github.com/Slicer/Slicer/tree/master/Libs/vtkSegmentationCore), which is a duplication. It would be better to have only one repository to ease maintenance and facilitate dissemination. Considering that this library does not depend on Slicer, and can potentially be used in other projects, it should be this one.

0xzz commented 5 years ago

Does this also entail incorporating the "vtkPlanarContourToClosedSurfaceConversionRule" and "vtkPlanarContourToRibbonModelConversionRule" (from https://github.com/SlicerRt/SlicerRT/blob/master/DicomRtImportExport/ConversionRules/) into PolySeg?

cpinter commented 5 years ago

It could, but this ticket is about making PolySeg an external module instead of just a sub-directory within the 3D Slicer source code.

We keep those converters (especially the ribbon related ones) in SlicerRT, because they only apply to RT scenarios, and so far PolySeg was only available within Slicer. I see why it would be useful, my only issue with that is that adding them to PolySeg would add non-generic converters by default part of PolySeg. Maybe I could add those converters but not register them by default (and registering them from SlicerRT or another RT application, which is one line of code each).

cpinter commented 5 years ago

That said it's very easy to add it for your own purposes. Just add the files to your branch working copy, add them in the CMakeLists.txt as well, register them where the others are registered and you're done.

0xzz commented 5 years ago

@cpinter Thank you. I managed to compile "vtkPlanarContourToClosedSurfaceConversionRule" into my working branch of PolySeg. Just to make sure. Below is what I did - does this look correct to you?

  1. Copy vtkPlanarContourToClosedSurfaceConversionRule.h and vtkPlanarContourToClosedSurfaceConversionRule.cxx into PolySeg source directory

  2. Add vtkPlanarContourToClosedSurfaceConversionRule.cxx and vtkPlanarContourToClosedSurfaceConversionRule.h to PolySeg's CMakeLists.txt

  3. Edit vtkPlanarContourToClosedSurfaceConversionRule.h:

#include "vtkSlicerDicomRtImportExportConversionRulesExport.h" to #include "PolySegConfigure.h"

class VTK_SLICER_DICOMRTIMPORTEXPORT_CONVERSIONRULES_EXPORT vtkPlanarContourToClosedSurfaceConversionRule to class PolySeg_EXPORT vtkPlanarContourToClosedSurfaceConversionRule

The other two ribbon-related conversion rules depend on "vtkSlicerRtCommon.h" and various Slicer MRML libraries further down the dependency line, so I didn't get them complied into PolySeg. (Fortunately, for my purpose, I only needed the Contour --> ClosedSurface conversion.) I see why those conversions rules have been allocated to the SlicerRT repo, as a way of making sure PolySeg only has very simple dependency requirements.

cpinter commented 5 years ago

Yes, this seems right to me.