Interpolation on/off and desired spacing in lng in config
This commit is contained in:
@ -508,93 +508,77 @@ int itkImageProcessor::load3DSerieFromFiles( std::vector<std::string> v_fnames){
|
||||
return -1;
|
||||
}
|
||||
|
||||
////////////////////////*****************//////////////////////////
|
||||
// here is where voume should be resampled IMO
|
||||
|
||||
// typedef itk::LinearInterpolateImageFunction<ImageType3D, double>
|
||||
// LinearInterpolatorType;
|
||||
|
||||
|
||||
// typedef itk::ResampleImageFilter<ImageType3D, ImageType3D>
|
||||
// ResampleFilterType;
|
||||
|
||||
// 2) Resample the series
|
||||
LinearInterpolatorType::Pointer
|
||||
linearInterpolator = LinearInterpolatorType::New();
|
||||
|
||||
// Set identity transform
|
||||
TransformType::Pointer
|
||||
transform = TransformType::New();
|
||||
transform->SetIdentity();
|
||||
|
||||
const typename ImageType3D::SpacingType& inputSpacing =
|
||||
imageSeriesReader3D->GetOutput()->GetSpacing();
|
||||
const typename ImageType3D::RegionType& inputRegion =
|
||||
imageSeriesReader3D->GetOutput()->GetLargestPossibleRegion();
|
||||
const typename ImageType3D::SizeType& inputSize =
|
||||
inputRegion.GetSize();
|
||||
|
||||
// Inputs Info
|
||||
// std::cout << "inputSpacing " << std::endl;
|
||||
// std::cout << inputSpacing << std::endl;
|
||||
// std::cout << "inputRegion " << std::endl;
|
||||
// std::cout << inputRegion << std::endl;
|
||||
// std::cout << "inputSize " << std::endl;
|
||||
// std::cout << inputSize << std::endl;
|
||||
|
||||
|
||||
ImageType3D::SpacingType outputSpacing;
|
||||
outputSpacing[0] = inputSpacing[0];
|
||||
outputSpacing[1] = inputSpacing[1];
|
||||
outputSpacing[2] = inputSpacing[2]/2;
|
||||
|
||||
ImageType3D::SizeType outputSize;
|
||||
// typedef typename ImageType3D::SizeType::SizeValueType SizeValueType;
|
||||
outputSize[0] = static_cast<SizeValueType>(
|
||||
inputSize[0] * inputSpacing[0] / outputSpacing[0] + .5);
|
||||
outputSize[1] = static_cast<SizeValueType>(
|
||||
inputSize[1] * inputSpacing[1] / outputSpacing[1] + .5);
|
||||
outputSize[2] = static_cast<SizeValueType>(
|
||||
inputSize[2] * inputSpacing[2] / outputSpacing[2] + .5);
|
||||
|
||||
ResampleInputFilterType::Pointer
|
||||
resampler = ResampleInputFilterType::New();
|
||||
|
||||
resampler->SetInput( imageSeriesReader3D->GetOutput() );
|
||||
resampler->SetTransform( transform );
|
||||
|
||||
resampler->SetInterpolator( linearInterpolator );
|
||||
|
||||
resampler->SetOutputOrigin( imageSeriesReader3D->GetOutput()->GetOrigin() );
|
||||
resampler->SetOutputSpacing( outputSpacing );
|
||||
resampler->SetOutputDirection( imageSeriesReader3D->GetOutput()->GetDirection() );
|
||||
resampler->SetSize( outputSize );
|
||||
resampler->Update();
|
||||
|
||||
|
||||
// const ImageType3D::SpacingType& outSpacing =
|
||||
// resampler->GetOutput()->GetSpacing();
|
||||
// const ImageType3D::RegionType& outRegion =
|
||||
// resampler->GetOutput()->GetLargestPossibleRegion();
|
||||
// const ImageType3D::SizeType& outSize =
|
||||
// outRegion.GetSize();
|
||||
|
||||
// Resampled Info
|
||||
// std::cout << "outSpacing " << std::endl;
|
||||
// std::cout << outSpacing << std::endl;
|
||||
// std::cout << "outRegion " << std::endl;
|
||||
// std::cout << outRegion << std::endl;
|
||||
// std::cout << "outSize " << std::endl;
|
||||
// std::cout << outSize << std::endl;
|
||||
|
||||
|
||||
////////////////////////*****************//////////////////////////
|
||||
|
||||
CastFilterType3D::Pointer caster3D =
|
||||
CastFilterType3D::New();
|
||||
|
||||
caster3D->SetInput(resampler->GetOutput());
|
||||
caster3D->Update();
|
||||
if(m_ResamplepCT == false){
|
||||
|
||||
caster3D->SetInput(imageSeriesReader3D->GetOutput());
|
||||
caster3D->Update();
|
||||
}else{
|
||||
std::cout << "Resampling pCT @ spacing in Z " << m_SamplingLNG << std::endl;
|
||||
|
||||
LinearInterpolatorType::Pointer
|
||||
linearInterpolator = LinearInterpolatorType::New();
|
||||
|
||||
// Set identity transform
|
||||
TransformType::Pointer
|
||||
transform = TransformType::New();
|
||||
transform->SetIdentity();
|
||||
|
||||
const typename ImageType3D::SpacingType& inputSpacing =
|
||||
imageSeriesReader3D->GetOutput()->GetSpacing();
|
||||
const typename ImageType3D::RegionType& inputRegion =
|
||||
imageSeriesReader3D->GetOutput()->GetLargestPossibleRegion();
|
||||
const typename ImageType3D::SizeType& inputSize =
|
||||
inputRegion.GetSize();
|
||||
|
||||
// Inputs Info
|
||||
// std::cout << "inputSpacing " << std::endl;
|
||||
// std::cout << inputSpacing << std::endl;
|
||||
// std::cout << "inputRegion " << std::endl;
|
||||
// std::cout << inputRegion << std::endl;
|
||||
// std::cout << "inputSize " << std::endl;
|
||||
// std::cout << inputSize << std::endl;
|
||||
|
||||
|
||||
ImageType3D::SpacingType outputSpacing;
|
||||
outputSpacing[0] = inputSpacing[0];
|
||||
outputSpacing[1] = inputSpacing[1];
|
||||
outputSpacing[2] = m_SamplingLNG;
|
||||
|
||||
ImageType3D::SizeType outputSize;
|
||||
// typedef typename ImageType3D::SizeType::SizeValueType SizeValueType;
|
||||
outputSize[0] = static_cast<SizeValueType>(
|
||||
inputSize[0] * inputSpacing[0] / outputSpacing[0] + .5);
|
||||
outputSize[1] = static_cast<SizeValueType>(
|
||||
inputSize[1] * inputSpacing[1] / outputSpacing[1] + .5);
|
||||
outputSize[2] = static_cast<SizeValueType>(
|
||||
inputSize[2] * inputSpacing[2] / outputSpacing[2] + .5);
|
||||
|
||||
ResampleInputFilterType::Pointer
|
||||
resampler = ResampleInputFilterType::New();
|
||||
|
||||
resampler->SetInput( imageSeriesReader3D->GetOutput() );
|
||||
resampler->SetTransform( transform );
|
||||
|
||||
resampler->SetInterpolator( linearInterpolator );
|
||||
|
||||
resampler->SetOutputOrigin( imageSeriesReader3D->GetOutput()->GetOrigin() );
|
||||
resampler->SetOutputSpacing( outputSpacing );
|
||||
resampler->SetOutputDirection( imageSeriesReader3D->GetOutput()->GetDirection() );
|
||||
resampler->SetSize( outputSize );
|
||||
resampler->Update();
|
||||
|
||||
|
||||
caster3D->SetInput(resampler->GetOutput());
|
||||
caster3D->Update();
|
||||
|
||||
}
|
||||
|
||||
////////////////////////*****************//////////////////////////
|
||||
|
||||
if (m_VolumeSourceDupli == NULL)
|
||||
std::cout << "NEVER HERE m_VolumeSourceDupli" << std::endl;
|
||||
|
@ -71,6 +71,12 @@ public:
|
||||
itkTypeMacro(itkImageProcessor, Object);
|
||||
|
||||
|
||||
itkSetMacro(ResamplepCT, bool);
|
||||
itkGetMacro(ResamplepCT, bool);
|
||||
|
||||
itkSetMacro(SamplingLNG, double);
|
||||
itkGetMacro(SamplingLNG, double);
|
||||
|
||||
CommandIterationUpdate::Pointer
|
||||
optimizerObserver;
|
||||
|
||||
@ -261,6 +267,11 @@ protected:
|
||||
virtual ~itkImageProcessor();
|
||||
void PrintSelf(std::ostream& os, itk::Indent indent) const;
|
||||
|
||||
bool
|
||||
m_ResamplepCT;
|
||||
double
|
||||
m_SamplingLNG;
|
||||
|
||||
private:
|
||||
itkImageProcessor(const Self&); //purposely not implemented
|
||||
void operator=(const Self&); //purposely not implemented
|
||||
|
Reference in New Issue
Block a user