Page MenuHomePhabricator

Refactor ImageGenerator for better usability
Closed, ResolvedPublic

Description

(1) automatically generates 2D Images if Z-dimension is set less or equal 1

In such case ( a single slice ) the corresponding object can be interpreted both as 2D and 3D image. From the ImageGenerator, in its current version, no single-slice 3D images can be generated.

(2) provides no option of creating an 'empty segmentation', i.e.

return an image with same geometry as a given reference image, user specified type and filled by a specified value

template< typename TPixelType>
static mitk::Image::Pointer GenerateImageFromReference( mitk::Image::Pointer reference_image, TPixelType fill_value )

Event Timeline

(ad 1) on the opposite, the GenerateGradientImage(...) only allows generating of 3D images. The ImageType is set to

itk::ImageType< TPixelType, 3> ImageType

regardles the value of the DimZ parameter provided by the caller.

SUPERBUILD_PATH and ITK_VERSION used to cover for the 'natural' differences.

Changes summary:

Implement the method for creating an image with single-valued pixels based on a reference image.
The other methods in the ImageGenerator do not provide such functionality.

Code Changes:

File: Core/include/mitkImageGenerator.h

+ template <typename TPixelType>
+ static mitk::Image::Pointer GenerateImageWithReference( mitk::Image::Pointer reference,
+ TPixelType fill_value )
+{ [IMPLEMENTATION] }

Purpose:

Needed to fix T18165, i.e. to allow a straightforward creation of a mask/segmentation object linked to some reference image and filled with a single user-defined value.

Shouldn't the method be named GenerateImageFROMReference?

User hering has pushed new remote branch:

bug-18617-RefactorImageGenerator

Changed signature to GenerateImageFromReference(), pushed to remote branch

[43e28b]: Merge branch 'bug-18617-RefactorImageGenerator'

Merged commits:

2015-01-14 17:03:49 Jan Hering [d72f82]
Enhance ImageGenerator