From: delmon Date: Thu, 6 Jan 2011 09:13:37 +0000 (+0000) Subject: Resample mask to overcome the bug with mask that doesn't have the same X-Git-Tag: v1.2.0~274 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=2d83e4d660b0fb679977954c0ffcb8a34e8eb455;p=clitk.git Resample mask to overcome the bug with mask that doesn't have the same resolution as the fixed image. --- diff --git a/registration/clitkBLUTDIRGenericFilter.cxx b/registration/clitkBLUTDIRGenericFilter.cxx index 3e6c6ec..9640282 100755 --- a/registration/clitkBLUTDIRGenericFilter.cxx +++ b/registration/clitkBLUTDIRGenericFilter.cxx @@ -340,13 +340,23 @@ namespace clitk } if (m_Verbose)std::cout <<"Reference image mask was read..." < ResamplerType; + typename ResamplerType::Pointer resampler = ResamplerType::New(); + typedef itk::NearestNeighborInterpolateImageFunction InterpolatorType; + typename InterpolatorType::Pointer interpolator = InterpolatorType::New(); + resampler->SetOutputParametersFromImage(fixedImage); + resampler->SetInterpolator(interpolator); + resampler->SetInput(maskReader->GetOutput()); + resampler->Update(); + // Set the image to the spatialObject - fixedMask->SetImage( maskReader->GetOutput() ); + fixedMask->SetImage(resampler->GetOutput()); // Find the bounding box of the "inside" label typedef itk::LabelGeometryImageFilter GeometryImageFilterType; typename GeometryImageFilterType::Pointer geometryImageFilter=GeometryImageFilterType::New(); - geometryImageFilter->SetInput(maskReader->GetOutput()); + geometryImageFilter->SetInput(resampler->GetOutput()); geometryImageFilter->Update(); typename GeometryImageFilterType::BoundingBoxType boundingBox = geometryImageFilter->GetBoundingBox(1);