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
14 changes: 9 additions & 5 deletions Modules/Core/Common/include/itkProcessObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,12 @@ class ITKCommon_EXPORT ProcessObject : public Object
/** STL array of data object names */
using NameArray = std::vector<DataObjectIdentifierType>;

/** Type of general multi-threader interface */
using MultiThreaderType = MultiThreaderBase;
#ifndef ITK_FUTURE_LEGACY_REMOVE
/** Type of general multi-threader interface
* \deprecated Please use `itk::MultiThreaderBase` directly.
*/
using MultiThreaderType [[deprecated("Please use `itk::MultiThreaderBase` directly.")]] = MultiThreaderBase;
#endif

/** \brief Return an array with the names of the inputs defined.
*
Expand Down Expand Up @@ -501,15 +505,15 @@ class ITKCommon_EXPORT ProcessObject : public Object
/** @ITKEndGrouping */

/** Return the multithreader used by this class. */
MultiThreaderType *
MultiThreaderBase *
GetMultiThreader() const
{
return m_MultiThreader;
}

/** Set the multithreader used by this class. */
void
SetMultiThreader(MultiThreaderType * threader);
SetMultiThreader(MultiThreaderBase * threader);

/** An opportunity to deallocate a ProcessObject's bulk data
* storage. Some filters may wish to reuse existing bulk data
Expand Down Expand Up @@ -1002,7 +1006,7 @@ class ITKCommon_EXPORT ProcessObject : public Object

/** Support processing data in multiple threads. Used by subclasses
* (e.g., ImageSource). */
itk::SmartPointer<MultiThreaderType> m_MultiThreader;
itk::SmartPointer<MultiThreaderBase> m_MultiThreader;
ThreadIdType m_NumberOfWorkUnits{};

bool m_ThreaderUpdateProgress{ true };
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/src/itkProcessObject.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ ProcessObject::ProcessObject()
m_IndexedInputs.push_back(m_Inputs.insert(p).first);
m_IndexedOutputs.push_back(m_Outputs.insert(std::move(p)).first);

this->Self::SetMultiThreader(MultiThreaderType::New());
this->Self::SetMultiThreader(MultiThreaderBase::New());
}


Expand Down Expand Up @@ -1552,7 +1552,7 @@ ProcessObject::GenerateOutputRequestedRegion(DataObject * output)


void
ProcessObject::SetMultiThreader(MultiThreaderType * threader)
ProcessObject::SetMultiThreader(MultiThreaderBase * threader)
{
if (this->m_MultiThreader != threader)
{
Expand Down
16 changes: 10 additions & 6 deletions Modules/Registration/Common/include/itkImageToImageMetric.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,14 @@ class ITK_TEMPLATE_EXPORT ImageToImageMetric : public SingleValuedCostFunction
itkGetConstReferenceMacro(UseCachingOfBSplineWeights, bool);
itkBooleanMacro(UseCachingOfBSplineWeights);
/** @ITKEndGrouping */
using MultiThreaderType = MultiThreaderBase;

#ifndef ITK_FUTURE_LEGACY_REMOVE
using MultiThreaderType [[deprecated("Please use `itk::MultiThreaderBase` directly.")]] = MultiThreaderBase;
#endif

/** Get the Threader. */
/** @ITKStartGrouping */
itkGetModifiableObjectMacro(Threader, MultiThreaderType);
itkGetModifiableObjectMacro(Threader, MultiThreaderBase);
const TransformPointer *
GetThreaderTransform()
{
Expand Down Expand Up @@ -600,15 +604,15 @@ class ITK_TEMPLATE_EXPORT ImageToImageMetric : public SingleValuedCostFunction
/**
* \class MultiThreaderWorkUnitInfoImageToImageMetricWrapper
* This helper local class is used to extract information from the
* MultiThreaderType::WorkUnitInfo info type
* MultiThreaderBase::WorkUnitInfo info type
* Do not allow inheritance for objects that are intended for static_cast<void *>
* \ingroup ITKRegistrationCommon
*/
class MultiThreaderWorkUnitInfoImageToImageMetricWrapper final
{
public:
MultiThreaderWorkUnitInfoImageToImageMetricWrapper(const void * workunitInfoAsVoid)
: m_WorkUnitInfo(static_cast<const typename MultiThreaderType::WorkUnitInfo *>(workunitInfoAsVoid))
: m_WorkUnitInfo(static_cast<const MultiThreaderBase::WorkUnitInfo *>(workunitInfoAsVoid))
Comment on lines -611 to +615
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the typename keyword is not necessary for MultiThreaderBase::WorkUnitInfo 😃

{}
[[nodiscard]] ThreadIdType
GetThreadId() const
Expand All @@ -622,10 +626,10 @@ class ITK_TEMPLATE_EXPORT ImageToImageMetric : public SingleValuedCostFunction
}

private:
const typename MultiThreaderType::WorkUnitInfo * m_WorkUnitInfo;
const MultiThreaderBase::WorkUnitInfo * m_WorkUnitInfo;
};

MultiThreaderType::Pointer m_Threader{};
MultiThreaderBase::Pointer m_Threader{};
std::unique_ptr<ConstantPointerWrapper> m_ConstSelfWrapper;
mutable std::unique_ptr<unsigned int[]> m_ThreaderNumberOfMovingImageSamples;
bool m_WithinThreadPreProcess{ false };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ ImageToImageMetric<TFixedImage, TMovingImage>::ImageToImageMetric()
, m_BSplineTransformIndices()
, m_BSplineInterpolator(nullptr)
, m_DerivativeCalculator(nullptr)
, m_Threader(MultiThreaderType::New())
, m_Threader(MultiThreaderBase::New())
, m_ConstSelfWrapper(std::make_unique<ConstantPointerWrapper>(this))
{
this->m_NumberOfWorkUnits = this->m_Threader->GetNumberOfWorkUnits();
Expand Down
Loading