[ITK-users] initializations needed to use the output of an Inplace-ITK-filter directly as the segmentation image in ITK-Snap >= v3.2

Grothausmann, Roman Dr. grothausmann.roman at mh-hannover.de
Mon Jun 29 08:38:56 EDT 2015


Dear mailing list members,


In short:

What extra initializations are needed if I want to use the output of an 
ITK-filter directly as the segmentation image in ITK-Snap >= v3.2?
(ITK-Mailinglist included for suggestions on what other options there are to run 
an image iterator multi-threaded but outside an ITK-ImageFilter)

Detailed description:

For my CnJ mode I iterate over the whole Jsrc and Jdst images to copy the label 
clicked on from Jsrc to Jdst ("painting" with the current selected label). I 
took the code from the ITK-Snap paint-brush. It works, however is quite slow (~ 
2-4 minutes for each click) for a 10G voxel image as the ROI is the whole image 
and not as small as for the paint-brush.

To mimic the iteration inside an ITK Filter I wrote an InplaceImageFilter with a 
ThreadedGenerateData method to do the iteration 
(https://github.com/romangrothausmann/itksnap/commit/f184efb82ad23e07b7a69a70d5fc334fb24c3961). 
With a small addition:
m_JdstWrapper->InitializeToWrapper(m_MainImageWrapper, m_JoinCF->GetOutput());
(https://github.com/romangrothausmann/itksnap/commit/82f72dc9cf2257025b561de98de08a9a6919f406) 

this now works for ITK-Snap v3.0. However, if I merge these changes into master 
or v3.2 the resulting ITK-Snap segfaults/asserts after InitializeJoinCF() but 
before CnJ mode is up and operational, the assertion occurs at: 
https://github.com/pyushkevich/itksnap/blob/master/Logic/Common/ImageCoordinateTransform.cxx#L217

My guess it that some part of the image transform/geometry code has changed 
between v3.0 and v3.2. It seems to me that m_Offset is not correctly initialized 
when used at 
https://github.com/pyushkevich/itksnap/blob/master/Logic/Common/ImageCoordinateTransform.cxx#L172
I hoped that m_JdstWrapper->CopyImageCoordinateTransform(m_MainImageWrapper) 
would do that but that didn't solve the issue.

What do I have to add to the initialization code of CnJ to make the filter work?
Or is it not possible to use the output of an ITK filter as the segmentation 
image in ITK-Snap directly? I could not find any code snippets where such a 
thing was done. All either had some "deep copy" or were for 2D slices only (when 
the transform was already applied or ignored).

I though of just using ITK-Snap v3.0 for this, but v3.0 only compiles with 
ITK-4.2, which I never managed to run multi-threaded (not even for simple CLIs). 
Was there a special configuration needed to make ITK-4.2 run multi-threaded? All 
other ITK versions before and after worked multi-threaded out of the box for me. 
Without multi-threading the whole optimization is useless.

NB: Similarly, the code for "deep copy image/region" is single threaded. As it 
is mostly used only when changing to a new mode, e.g. Snake mode, this is not as 
problematic as it is with the repeted interaction in CnJ mode. Still, for my 
current 10G images, this takes a couple of minutes in which one fears that 
ITK-Snap crashed as it does not react meanwhile. So this kind of ITK-Filter 
could be useful here as well.

I'd be very thankful for any help and suggestions how to resolve this issue.
Roman

-- 
Dr. Roman Grothausmann

Tomographie und Digitale Bildverarbeitung
Tomography and Digital Image Analysis

Institut für Funktionelle und Angewandte Anatomie, OE 4120
Medizinische Hochschule Hannover
Carl-Neuberg-Str. 1
D-30625 Hannover

Tel. +49 511 532-2900


More information about the Insight-users mailing list