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