I am using GPU Demons for myself project. I find a strange bug: the size of input (fix and moving image) is (174, 256, 256), but the size of output is (87, 128, 128).
The main code is:
RegistrationFilterType::Pointer DemonsFilter = RegistrationFilterType::New();
CommandIterationUpdate::Pointer observer = CommandIterationUpdate::New();
DemonsFilter->AddObserver(itk::IterationEvent(), observer);
DemonsFilter->SetFixedImage(fixImageCPUToGPUFilter->GetOutput());
DemonsFilter->SetMovingImage(movingImageCPUToGPUFilter->GetOutput());
DemonsFilter->GetOutput()->SetRequestedRegionToLargestPossibleRegion();
auto sizexxx = gpuDisplacementField->GetLargestPossibleRegion().GetSize();
if (i != 0)
{
DemonsFilter->SetInitialDisplacementField(gpuDisplacementField);
}
else
{
DemonsFilter->SetInitialDisplacementField(nullptr);
}
DemonsFilter->SetNumberOfIterations(nIterations[i]);
DemonsFilter->SetStandardDeviations(1.0);
DemonsFilter->Update();
auto fixImageSize = DemonsFilter->GetFixedImage()->GetLargestPossibleRegion().GetSize();
std::cout << "fix image size: " << fixImageSize << std::endl;
auto movingImageSize = DemonsFilter->GetMovingImage()->GetLargestPossibleRegion().GetSize();
std::cout << "moving image size: " << movingImageSize << std::endl;
auto displacementSize = DemonsFilter->GetOutput()->GetLargestPossibleRegion().GetSize();
std::cout << "displacement size: " << displacementSize << std::endl;
And the information in the console is:
fix image size: [174, 256, 256]
moving image size: [174, 256, 256]
displacement size: [87, 128, 128]
Why the size of displacement is not (174, 256, 256) ??
Moreover, I have visualized the displacement field, and the result is just random noise. Also, I have checked the input fix and moving image, and they are correct.
How can I make the demons registration correct?