itksnap icon indicating copy to clipboard operation
itksnap copied to clipboard

Click'n'Join-Mode extension to ITK-SNAP incuding global, dynamic watershed segmentation

Open romangrothausmann opened this issue 9 years ago • 5 comments

These extensions to ITK-SNAP implement a global watershed segmentation mode (gWS). The extensions incorporate a Click'n'Join mode (CnJ) as the intended usage of gWS is related to the SegmentationEditor (http://www.itk.org/ITK/applications/segmentationeditor.html, demo video: SegmentationEditor.avi of http://www.insight-journal.org/browse/publication/70). In CnJ mode, the user can add or remove labels from a source label image to a destination label image. The source image can either be the currently loaded segmentation, one from a file or the output of gWS. The over or under segmentation can be dynamically controlled during CnJ+gWS avoiding a complete recomputation of the watershed segementation. There is also an extension to the "adaptive" brush of ITK-SNAP to make use of this dynamic WS (dWS) relevelling which can then be adjusted with the mouse wheel.

CnJ on the output of a morphological watershed (with borders): ss_cnj_01

CnJ+gWS: ss_gws_04

romangrothausmann avatar Mar 10 '15 11:03 romangrothausmann

I managed to get 64bit "Join Source Image" (Jsrc) working, now even with itkScalarToRGBPixelFunctor. 64bit is essential for proper function of gWS, as otherwise casting to 16bit causes multiple regions to be added to Jdst even though only a single label is clicked on in Jsrc. However, with 64bit the LUT usually used for the label/segmentation image is too short an not suitable for Jsrc any more. Therefore itkScalarToRGBPixelFunctor (can be regarded as an infinite LUT) is now used to colour Jsrc. This works very well for gWS but its colours for small label IDs are quite similar. This is a disadvantage when using plain CnJ. Ideally, the user should be given an option which type of colouring should be used, or should be made dependent on the mode.

gWS in stage 3 showing the overlayed "Join Source Image" colored with itkScalarToRGBPixelFunctor: ss_gws_06

romangrothausmann avatar Mar 14 '15 09:03 romangrothausmann

Apart from some minor tweaks, I added a new layer to gWS that allows the user to see and inspect the output of the pre-filters that yield the input to gWS, it's called "GWS source image" (WsrcImage). So far it is displayed with a Red-White-Blue LUT fixed to a value rang from -100 to 100 as I could not yet figure out how to set it up such that contrast adjustments (e.g. auto contrast) are available as it is the case for e.g. overlays.

gWS in stage 2 showing the "GWS source image": ss_gws_05

romangrothausmann avatar Mar 23 '15 14:03 romangrothausmann

Got closed due to branch renaming.

romangrothausmann avatar Jan 30 '18 09:01 romangrothausmann

Parallelized itkJoinCopyFilter now working in CnJ mode, which about halves the time needed for processing each CnJ-click. The other half is apparently spent on a single-threaded process (which could possibly be avoided, needs further investigation). The modifications include the integration of v3.4 changes, e.g. RLEImage and ITK-4.5.2 improvements.

romangrothausmann avatar Jan 31 '18 20:01 romangrothausmann

The single-threaded process that took up time was StoreUndoPoint, which is not working for CnJ in v3.4 any way. On a workstation with 24 Intel Xeon CPUs (from 2012) processing a CnJ-click now takes less than 2 seconds for a dataset of 1400x1750x1750 voxel (16GB for 32-bit integer of a watershed pre-segmentation) that used to take around 30 seconds.

romangrothausmann avatar Feb 02 '18 13:02 romangrothausmann