diff --git a/Modules/Filtering/ImageFilterBase/include/itkUnaryGeneratorImageFilter.hxx b/Modules/Filtering/ImageFilterBase/include/itkUnaryGeneratorImageFilter.hxx index 7e7e2a11533..c79ad4e533e 100644 --- a/Modules/Filtering/ImageFilterBase/include/itkUnaryGeneratorImageFilter.hxx +++ b/Modules/Filtering/ImageFilterBase/include/itkUnaryGeneratorImageFilter.hxx @@ -54,7 +54,7 @@ UnaryGeneratorImageFilter::GenerateOutputInformation( // this filter allows the input the output to be of different dimensions // get pointers to the input and output - auto * outputPtr = dynamic_cast(this->GetOutput()); + OutputImageType * outputPtr = this->GetOutput(); const InputImageType * inputPtr = this->GetInput(); if (!outputPtr || !inputPtr) diff --git a/Modules/Filtering/ImageGradient/include/itkVectorGradientMagnitudeImageFilter.hxx b/Modules/Filtering/ImageGradient/include/itkVectorGradientMagnitudeImageFilter.hxx index 9a008e51bf8..a365fd7e879 100644 --- a/Modules/Filtering/ImageGradient/include/itkVectorGradientMagnitudeImageFilter.hxx +++ b/Modules/Filtering/ImageGradient/include/itkVectorGradientMagnitudeImageFilter.hxx @@ -200,8 +200,7 @@ VectorGradientMagnitudeImageFilter::Dynami NeighborhoodAlgorithm::ImageBoundaryFacesCalculator bC; RadiusType r1; r1.Fill(1); - faceList = - bC(dynamic_cast(m_RealValuedInputImage.GetPointer()), outputRegionForThread, r1); + faceList = bC(m_RealValuedInputImage.GetPointer(), outputRegionForThread, r1); typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType::iterator fit; fit = faceList.begin(); @@ -213,8 +212,7 @@ VectorGradientMagnitudeImageFilter::Dynami // conditions. for (fit = faceList.begin(); fit != faceList.end(); ++fit) { - bit = ConstNeighborhoodIteratorType( - r1, dynamic_cast(m_RealValuedInputImage.GetPointer()), *fit); + bit = ConstNeighborhoodIteratorType(r1, m_RealValuedInputImage.GetPointer(), *fit); it = ImageRegionIterator(this->GetOutput(), *fit); bit.OverrideBoundaryCondition(&nbc); bit.GoToBegin(); diff --git a/Modules/Filtering/LabelMap/include/itkInPlaceLabelMapFilter.hxx b/Modules/Filtering/LabelMap/include/itkInPlaceLabelMapFilter.hxx index 8a1db3b4e27..1c22d9b8582 100644 --- a/Modules/Filtering/LabelMap/include/itkInPlaceLabelMapFilter.hxx +++ b/Modules/Filtering/LabelMap/include/itkInPlaceLabelMapFilter.hxx @@ -70,7 +70,7 @@ InPlaceLabelMapFilter::AllocateOutputs() // Graft this first input to the output. Later, we'll need to // remove the input's hold on the bulk data. // - OutputImagePointer inputAsOutput = dynamic_cast(const_cast(this->GetInput())); + OutputImagePointer inputAsOutput = const_cast(this->GetInput()); if (inputAsOutput) { diff --git a/Modules/IO/TransformBase/src/itkTransformFileWriterSpecializations.cxx b/Modules/IO/TransformBase/src/itkTransformFileWriterSpecializations.cxx index a0604080af6..d40cb3d2f41 100644 --- a/Modules/IO/TransformBase/src/itkTransformFileWriterSpecializations.cxx +++ b/Modules/IO/TransformBase/src/itkTransformFileWriterSpecializations.cxx @@ -310,7 +310,7 @@ AddToTransformList(typename TInputTransformType::ConstPointer & tran for (; it != inputTransformList.end(); ++it) { // get the input sub transform - const auto * inSub = dynamic_cast((*it).GetPointer()); + const InputTransformType * const inSub = it->GetPointer(); // convert each sub transform and push them to the output transform list std::string inSubName = inSub->GetTransformTypeAsString(); OutputTransformPointer convertedSub = IOhelper::CreateNewTypeTransform(inSubName); diff --git a/Modules/Registration/Metricsv4/test/itkMetricImageGradientTest.cxx b/Modules/Registration/Metricsv4/test/itkMetricImageGradientTest.cxx index 7ec78a01fa8..939e796f587 100644 --- a/Modules/Registration/Metricsv4/test/itkMetricImageGradientTest.cxx +++ b/Modules/Registration/Metricsv4/test/itkMetricImageGradientTest.cxx @@ -271,8 +271,7 @@ itkMetricImageGradientTestRunTest(unsigned int imageSize, // typename TTransform::InverseTransformBasePointer // movingTransform = transform->GetInverseTransform(); - typename TTransform::Pointer movingTransform = - dynamic_cast(transform->GetInverseTransform().GetPointer()); + typename TTransform::Pointer movingTransform = transform->GetInverseTransform().GetPointer(); // Write out the images if requested, for debugging only if (false) diff --git a/Modules/Video/Core/test/itkTemporalProcessObjectTest.cxx b/Modules/Video/Core/test/itkTemporalProcessObjectTest.cxx index 3df43e4328d..1ef3fbddd4c 100644 --- a/Modules/Video/Core/test/itkTemporalProcessObjectTest.cxx +++ b/Modules/Video/Core/test/itkTemporalProcessObjectTest.cxx @@ -262,7 +262,7 @@ class DummyTemporalDataObject : public TemporalDataObject for (SizeValueType i = 0; i < x; ++i) { // Create a new DataObject - DataObject::Pointer obj = dynamic_cast(DataObject::New().GetPointer()); + DataObject::Pointer obj = DataObject::New().GetPointer(); // Append to the end of the buffer m_DataObjectBuffer->MoveHeadForward(); @@ -362,7 +362,7 @@ class DummyTemporalProcessObject : public TemporalProcessObject // Just pass frames from the input through to the output and add debug info for (SizeValueType i = outputStart; i < outputStart + numFramesOut; ++i) { - DataObject::Pointer newObj = dynamic_cast(DataObject::New().GetPointer()); + DataObject::Pointer newObj = DataObject::New().GetPointer(); // Set the output this->GetOutput()->SetObjectAtFrame(i, newObj); diff --git a/Modules/Video/IO/include/itkVideoFileWriter.hxx b/Modules/Video/IO/include/itkVideoFileWriter.hxx index 23955fde4aa..2924894cfc1 100644 --- a/Modules/Video/IO/include/itkVideoFileWriter.hxx +++ b/Modules/Video/IO/include/itkVideoFileWriter.hxx @@ -217,8 +217,8 @@ void VideoFileWriter::TemporalStreamingGenerateData() { // Get a non-const pointer to the input and output - const auto * input = dynamic_cast(this->GetInput()); - auto * output = dynamic_cast(this->GetOutput(0)); + const VideoStreamType * const input = this->GetInput(); + auto * output = dynamic_cast(this->GetOutput(0)); if (!output) { itkExceptionMacro("Could not cast output to TemporalDataObject");