[Insight-users] imageregistration with mask fails because of all points outside of all points mapped outside of moving image
Luis Ibanez
luis.ibanez at kitware.com
Thu Mar 18 12:36:57 EDT 2010
Hi Michiel,
Thanks for sharing with the list the method that you found
for solving the problem.
Luis
----------------------------------------------------------------------
On Wed, Mar 10, 2010 at 10:15 AM, michiel mentink
<michael.mentink at st-hughs.ox.ac.uk> wrote:
>
> Dear Luis,
>
> I have solved the problem by extending imageRegistration12 to 3 dimensions
> and changing the
> registration method and optimizer references to Versor3D.
>
> cheers,
>
> Michael
>
> On Mon, Mar 8, 2010 at 11:04 AM, michiel mentink
> <michael.mentink at st-hughs.ox.ac.uk> wrote:
>>
>> that should be
>> The tibia is segmented and all the 'tibia' voxels have grey values (not
>> binary).
>>
>>
>>
>>
>> On Mon, Mar 8, 2010 at 11:03 AM, michiel mentink
>> <michael.mentink at st-hughs.ox.ac.uk> wrote:
>>>
>>> Dear Luis,
>>>
>>> Background: I have an image volume, MRI of the knee. The tibia is
>>> segmented and
>>> all the 'femur' voxels have grey values (not binary). All the rest is
>>> black.
>>> Therefore, I create a mask by applying a thresholder with a threshold of
>>> 1: all the
>>> voxels that have intensity>0 are given the value '1'.
>>>
>>> typedef itk::ThresholdImageFilter< FixedImageType >
>>> ThresholdFilterType;
>>> ThresholdFilterType::Pointer thresholder =
>>> ThresholdFilterType::New();
>>> thresholder->SetInput( fixedImage);
>>> thresholder->SetOutsideValue( 1 );
>>> thresholder->ThresholdAbove( 0 );
>>> thresholder->Update();
>>>
>>> // insert caster here, casting from float to unsigned char
>>> typedef unsigned char MaskPixelType;
>>> typedef itk::Image< MaskPixelType, Dimension > MaskImageType;
>>> typedef itk::CastImageFilter< FixedImageType, MaskImageType >
>>> CastFilterType;
>>>
>>> CastFilterType::Pointer caster = CastFilterType::New();
>>> caster->SetInput( thresholder->GetOutput() );
>>>
>>> // create a 3D mask type
>>> typedef itk::ImageMaskSpatialObject< 3 > MaskType;
>>> // then create the mask itself
>>> MaskType::Pointer mask = MaskType::New();
>>>
>>> //connect the binary image to the mask
>>> mask->SetImage(caster->GetOutput() );
>>>
>>> // pass the spatial object mask to the image metric
>>> metric->SetFixedImageMask( mask);
>>> // metric->SetMovingImageMask( mask);
>>>
>>> // write the mask to a file, just to check if thresholding went alright
>>> typedef itk::ImageFileWriter< MaskImageType > MaskImageWriter;
>>> MaskImageWriter::Pointer writerBinary = MaskImageWriter::New();
>>> writerBinary->SetInput( caster->GetOutput() );
>>> writerBinary->SetFileName("mask.mhd" );
>>> writerBinary->Update();
>>> std::cout << "mask created" << std::endl << std::endl;
>>>
>>> I'm afraid I can't post the mask file to the mailing list (1.7MB) but
>>> I'll mail it to you.
>>>
>>> cheers,
>>>
>>> Michael
>>>
>>>
>>>
>>> On Sat, Mar 6, 2010 at 11:02 PM, Luis Ibanez <luis.ibanez at kitware.com>
>>> wrote:
>>>>
>>>> Hi Michiel,
>>>>
>>>> Thanks for sharing your findings in this problem.
>>>>
>>>> Can you tell us more about the mask (the segmentation)
>>>> that you created ?
>>>>
>>>> Have you checked this mask with any visualization
>>>> application ?
>>>>
>>>> What are the pixel values ?
>>>>
>>>> Is there a chance that you could share that binary image
>>>> with us ?
>>>>
>>>>
>>>> Thanks
>>>>
>>>>
>>>> Luis
>>>>
>>>>
>>>> ---------------------------------------------------------------------------
>>>> On Fri, Mar 5, 2010 at 11:28 AM, michiel mentink
>>>> <michael.mentink at st-hughs.ox.ac.uk> wrote:
>>>> > Dear all,
>>>> >
>>>> > When running an image registration algorithm with mask, I get this
>>>> > error:
>>>> >
>>>> > File:
>>>> >
>>>> > /MMprogs/src/ITK_src/Code/Algorithms/itkMeanSquaresImageToImageMetric.txx
>>>> > Line: 364
>>>> > Description: itk::ERROR: MeanSquaresImageToImageMetric(0x95f63f0): All
>>>> > the
>>>> > points mapped to outside of the moving image
>>>> >
>>>> > I've traced this to the following problem:
>>>> > in ImageMaskSpatialObject->IsInside(), all points are found outside of
>>>> > the
>>>> > mask/image (?)
>>>> >
>>>> > and this is because the boundingbox of the mask has bounding values of
>>>> > 0, 0,
>>>> > 0, 0, 0, 0, so indeed, there are no points that
>>>> > can be found inside these values.
>>>> >
>>>> > I am a bit stuck now, apparently, the mask that I created from a
>>>> > segmented
>>>> > volume is not converted into a bounding box correctly.
>>>> >
>>>> > Where do I check to find out why this is happening?
>>>> >
>>>> > cheers,
>>>> >
>>>> > Michael
>>>> >
>>>> >
>>>> > ps: some more info about my data:
>>>> >
>>>> > new moving image origin: [0, 0, 0]
>>>> > fixed image size: [215, 172, 48]
>>>> > fixed image origin: [44.0625, 0, 0]
>>>> > fixed image spacing: [0.3125, 0.3125, 1.9808]
>>>> > fixed image direction:
>>>> > 1 0 0
>>>> > 0 1 0
>>>> > 0 0 1
>>>> >
>>>> >
>>>> > moving image size: [512, 512, 52]
>>>> > moving image origin: [0, 0, 0]
>>>> > moving image spacing: [0.3125, 0.3125, 1.92911]
>>>> > moving image direction:
>>>> > 1 0 0
>>>> > 0 1 0
>>>> > 0 0 1
>>>> >
>>>> >
>>>> > image mask size: [215, 172, 48]
>>>> > image mask origin: [44.0625, 0, 0]
>>>> > image mask spacing: [0.3125, 0.3125, 1.9808]
>>>> > image mask direction:
>>>> > 1 0 0
>>>> > 0 1 0
>>>> > 0 0 1
>>>> >
>>>> >
>>>> > _____________________________________
>>>> > Powered by www.kitware.com
>>>> >
>>>> > Visit other Kitware open-source projects at
>>>> > http://www.kitware.com/opensource/opensource.html
>>>> >
>>>> > Kitware offers ITK Training Courses, for more information visit:
>>>> > http://www.kitware.com/products/protraining.html
>>>> >
>>>> > Please keep messages on-topic and check the ITK FAQ at:
>>>> > http://www.itk.org/Wiki/ITK_FAQ
>>>> >
>>>> > Follow this link to subscribe/unsubscribe:
>>>> > http://www.itk.org/mailman/listinfo/insight-users
>>>> >
>>>> >
>>>
>>>
>>
>
>
More information about the Insight-users
mailing list