//the actual processing
void BeforeThreadedGenerateData();
- #if ITK_VERSION_MAJOR >= 4
void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId );
- #else
- void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, int threadId );
- #endif
//member data
typename WeightsImageType::Pointer m_Weights;
//=========================================================================================================================
//update the output for the outputRegionForThread
template<class InputImageType, class OutputImageType>
- #if ITK_VERSION_MAJOR >= 4
void HelperClass1<InputImageType, OutputImageType>::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId )
- #else
- void HelperClass1<InputImageType, OutputImageType>::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, int threadId )
- #endif
{
// std::cout << "HelperClass1::ThreadedGenerateData - IN " << threadId << std::endl;
//Get pointer to the input
typedef typename OutputImageType::PixelType DisplacementType;
DisplacementType displacement;
inputIt.GoToBegin();
-
+
typename OutputImageType::SizeType size = outputPtr->GetLargestPossibleRegion().GetSize();
//define some temp variables
overlap *= 1.0 - distance[dim];
}
upper >>= 1;
-
+
if (neighIndex[dim] >= size[dim])
neighIndex[dim] = size[dim] - 1;
}
//the actual processing
- #if ITK_VERSION_MAJOR >= 4
void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId );
- #else
- void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, int threadId );
- #endif
//member data
typename WeightsImageType::Pointer m_Weights;
//Empty constructor
template<class InputImageType, class OutputImageType > HelperClass2<InputImageType, OutputImageType>::HelperClass2()
{
- m_EdgePaddingValue=itk::NumericTraits<PixelType>::Zero;
+ PixelType zero;
+ for(unsigned int i=0;i <PixelType::Dimension; i++) zero[i] = 0.0;
+ m_EdgePaddingValue=zero;
+ //m_EdgePaddingValue=itk::NumericTraits<PixelType>::Zero;
}
//=========================================================================================================================
//update the output for the outputRegionForThread
- #if ITK_VERSION_MAJOR >= 4
template<class InputImageType, class OutputImageType > void HelperClass2<InputImageType, OutputImageType>::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId )
- #else
- template<class InputImageType, class OutputImageType > void HelperClass2<InputImageType, OutputImageType>::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, int threadId )
- #endif
{
// std::cout << "HelperClass2::ThreadedGenerateData - IN " << threadId << std::endl;
-
+
//Get pointer to the input
typename InputImageType::ConstPointer inputPtr = this->GetInput();
++inputIt;
}//end while
-
+
// std::cout << "HelperClass2::ThreadedGenerateData - OUT " << threadId << std::endl;
-
+
}//end member
template <class InputImageType, class OutputImageType>
InvertVFFilter<InputImageType, OutputImageType>::InvertVFFilter()
{
- m_EdgePaddingValue=itk::NumericTraits<PixelType>::Zero; //no other reasonable value?
+
+ //m_EdgePaddingValue=itk::NumericTraits<PixelType>::Zero; //no other reasonable value?
+ PixelType zero;
+ for(unsigned int i=0;i <PixelType::Dimension; i++) zero[i] = 0.0;
+ m_EdgePaddingValue=zero; //no other reasonable value?
+
m_ThreadSafe=false;
m_Verbose=false;
}
//Set the output
this->SetNthOutput(0, helper2->GetOutput());
-
+
//std::cout << "InvertVFFilter::GenerateData - OUT" << std::endl;
}
}
else {
- std::cerr << "Mask image has a different size/spacing than input. Abort" << std::endl;
+ std::cerr << "Mask image has a different size/spacing than input. Abort. (Use option to resize)" << std::endl;
exit(-1);
}
}
}
else {
labelImage=LabelImageType::New();
+ labelImage->SetDirection(input->GetDirection());
labelImage->SetRegions(input->GetLargestPossibleRegion());
labelImage->SetOrigin(input->GetOrigin());
labelImage->SetSpacing(input->GetSpacing());
+ labelImage->SetDirection(input->GetDirection());
labelImage->Allocate();
labelImage->FillBuffer(m_ArgsInfo.label_arg[0]);
}
std::cout<<std::endl;
if (m_Verbose) std::cout<<"-------------"<<std::endl;
- if (m_Verbose) std::cout<<"| Label: "<<label<<" |"<<std::endl;
+ if (m_Verbose) std::cout<<"| Label: "<< (int) label<<" |"<<std::endl;
if (m_Verbose) std::cout<<"-------------"<<std::endl;
// Histograms
std::cout<<statisticsFilter->GetMaximum(label)<<std::endl;
if (m_Verbose) std::cout<<"Sum: ";
std::cout<<statisticsFilter->GetSum(label)<<std::endl;
+ if (m_Verbose) std::cout<<"Volume (cc): ";
+ std::cout<<statisticsFilter->GetCount(label)*spacing_cc<<std::endl;
if (m_Verbose) std::cout<<"Bounding box: ";
for(unsigned int i =0; i <statisticsFilter->GetBoundingBox(label).size(); i++)
std::cout<<statisticsFilter->GetBoundingBox(label)[i]<<" ";
typename FilterType::Pointer warp_filter = FilterType::New();
warp_filter->SetInput(input);
- #if ITK_VERSION_MAJOR >= 4
warp_filter->SetDisplacementField(resampler->GetOutput());
- #else
- warp_filter->SetDeformationField(resampler->GetOutput());
- #endif
warp_filter->SetOutputSpacing(input->GetSpacing());
warp_filter->SetOutputOrigin(input->GetOrigin());
warp_filter->SetOutputSize(input->GetLargestPossibleRegion().GetSize());
// Average
VFPixelType vector;
- VFPixelType zeroVector=itk::NumericTraits<VFPixelType>::Zero;
+ VFPixelType zeroVector;//=itk::NumericTraits<VFPixelType>::Zero;
+ for(unsigned int i=0;i <VFPixelType::Dimension; i++) zeroVector[i] = 0.0;
while (!(iterators[0]).IsAtEnd()) {
vector=zeroVector;
p_bar.setValue(progress);
p_bar.show();
}
-