ColorLabelTableDisplayMappingPolicy for long unsigned int

16 views
Skip to first unread message

Dr. Roman Grothausmann

unread,
Dec 1, 2014, 7:09:48 AM12/1/14
to itksn...@googlegroups.com
Dear mailing list members,


How can I modify the ColorLabelTableDisplayMappingPolicy to accept also images
containing labels of long unsigned int, i.e. the output of the
itkWatershedImageFilter?
It seems that this image type only causes problems for:
m_RGBAFilter[i]->SetInput(wrapper->GetSlice(i));
i.e. m_RGBAFilter can only handle short but the slice from the output of a
itkWatershedImageFilter is of type long.
I tried to incorporate a CastImageFilter (see below, as the loss of precision
does not matter for the colouring), but that cannot be updated because the input
region size is [0,0] at that position of the pipeline:


typedef itk::Image<typename TWrapperTraits::ComponentType, 2> JsrcImageType;
typedef itk::Image<LabelType, 2> LabelInputSliceType;
typedef itk::CastImageFilter<JsrcImageType, LabelInputSliceType> CIFType;
typename CIFType::Pointer cif;
cif = CIFType::New();
wrapper->GetSlice(i)->Print(std::cerr);
cif->SetInput(dynamic_cast<JsrcImageType *>(wrapper->GetSlice(i)));
//cif->InPlaceOff();
cif->Print(std::cerr);
std::cerr << "cif->Update" << std::endl;
//cif->UpdateLargestPossibleRegion();
cif->Update(); ////crashes as input region size is [0,0]
cif->GetOutput()->Print(std::cerr);
m_RGBAFilter[i]->SetInput(cif->GetOutput());


I wonder if there is a better place to do the casting but e.g.
Logic/Slicing/IRISSlicer.txx didn't seem more promising to me.

Or how could I create a new ColorLabelTableDisplayMappingPolicy2 that would
handle long?
It seems that the typedef itk::Image<LabelType, 2> InputSliceType; in
DisplayMappingPolicy.h is not used, i.e. changing it to use long for labels has
no effect.

Setting the Label type globally to long in SNAPCommon.h:
typedef itk::IdentifierType LabelType;
confuses Qt.

Any help or hints how I can handle this type mismatch are very welcome
Thanks,
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-9574

Dr. Roman Grothausmann

unread,
Mar 10, 2015, 10:15:01 AM3/10/15
to itksn...@googlegroups.com, itksna...@googlegroups.com, ITK Mailing List
Dear mailing list members,


To ease further development and possible help, my extensions to ITK-Snap
(Click'n'Join and a global dynamic watershed segmentation mode) are now
available on github: https://github.com/romangrothausmann/itksnap.git

The branch rel_3.0+gdWS contains the changes needed for ITK-Snap v3.0,
rel_3.2+gdWS for ITK-Snap v3.2 and master+gdWS for the newest development. For
this branch there is also a PR (https://github.com/pyushkevich/itksnap/pull/1)
with a short description and two screen shots, a documentation (article in the
MIDAS journal) is on the way.

One point on the ToDo list I would need help on is the realization of the
join-srouce-image being 64-bit (itk::IdentifierType) and possibly coloured with
itk::ScalarToRGBPixelFunctor. Other things I tried are those reported before/below.
So if someone has any idea how to realize this or would like to take part in
further development, please let me know.

Thanks for any help or hints.
Roman
Reply all
Reply to author
Forward
0 new messages