Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions include/rtkDisplacedDetectorForOffsetFieldOfViewImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,18 @@ DisplacedDetectorForOffsetFieldOfViewImageFilter<TInputImage, TOutputImage>::Gen
<< "Consider disabling it by setting m_Disable=true "
<< "or using the nodisplaced flag of the application you are running");
}
else if (this->GetGeometry()->GetSourceToDetectorDistances().front() == 0.)
{
itkGenericExceptionMacro(<< "Displaced detector cannot handle parallel geometry. "
<< "Consider disabling it by setting m_Disable=true "
<< "or using the nodisplaced flag of the application you are running");
}

if (this->GetOffsetsSet())
{
itkGenericExceptionMacro(<< "DisplacedDetectorForOffsetFieldOfViewImageFilter cannot use manually set offsets. "
<< "Use DisplacedDetectorImageFilter when processing independent projections.");
}

using FOVFilterType = typename rtk::FieldOfViewImageFilter<OutputImageType, OutputImageType>;
auto fieldofview = FOVFilterType::New();
Expand Down
3 changes: 3 additions & 0 deletions include/rtkDisplacedDetectorImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ class ITK_TEMPLATE_EXPORT DisplacedDetectorImageFilter : public itk::InPlaceImag
itkGetMacro(InferiorCorner, double);
itkGetMacro(SuperiorCorner, double);

/** Returns true when offsets were explicitly provided */
itkGetMacro(OffsetsSet, bool);

Comment thread
SimonRit marked this conversation as resolved.
/** Checks that inputs are correctly set. */
void
VerifyPreconditions() const override;
Expand Down
6 changes: 6 additions & 0 deletions include/rtkDisplacedDetectorImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ DisplacedDetectorImageFilter<TInputImage, TOutputImage>::GenerateOutputInformati
<< "Consider disabling it by setting m_Disable=true "
<< "or using the nodisplaced flag of the application you are running");
}
else if (this->GetGeometry()->GetSourceToDetectorDistances().front() == 0.)
{
itkGenericExceptionMacro(<< "Displaced detector cannot handle parallel geometry. "
<< "Consider disabling it by setting m_Disable=true "
<< "or using the nodisplaced flag of the application you are running");
}

// Compute the X coordinates of the corners of the image
typename Superclass::InputImageType::PointType corner;
Expand Down
15 changes: 15 additions & 0 deletions test/rtkdisplaceddetectorcompoffsettest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "rtkSheppLoganPhantomFilter.h"

#include <itkStreamingImageFilter.h>
#include <itkTestingMacros.h>

/**
* \file rtkdisplaceddetectorcompcudatest.cxx
Expand Down Expand Up @@ -96,6 +97,20 @@ rtkdisplaceddetectorcompoffsettest(int, char *[])

CheckImageQuality<OutputImageType>(streamingCUDA->GetOutput(), streamingCPU->GetOutput(), 1.e-6, 100, 1.);
}
{
constexpr double minOffset = -16.;
constexpr double maxOffset = 12.;

std::cout << "\n\n****** Case 4: manual offsets are not supported ******" << std::endl;

using OffsetDDFType = rtk::DisplacedDetectorForOffsetFieldOfViewImageFilter<OutputImageType>;
auto cudaddf = OffsetDDFType::New();
cudaddf->SetInput(slp->GetOutput());
cudaddf->SetGeometry(geometry);
cudaddf->SetOffsets(minOffset, maxOffset);
cudaddf->InPlaceOff();
ITK_TRY_EXPECT_EXCEPTION(cudaddf->Update());
}
Comment thread
SimonRit marked this conversation as resolved.

// If all succeed
std::cout << "\n\nTest PASSED! " << std::endl;
Expand Down
Loading