Merge branch 'ScoutRTresampVolume' into 'ScoutRTUIDevel'
pCT Resampling See merge request cpt_bioeng/drt!33
This commit is contained in:
@ -508,12 +508,77 @@ int itkImageProcessor::load3DSerieFromFiles( std::vector<std::string> v_fnames){
|
||||
return -1;
|
||||
}
|
||||
|
||||
////////////////////////*****************//////////////////////////
|
||||
|
||||
CastFilterType3D::Pointer caster3D =
|
||||
CastFilterType3D::New();
|
||||
|
||||
caster3D->SetInput(imageSeriesReader3D->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
|
||||
@ -290,6 +301,11 @@ private:
|
||||
using ImageIOType = itk::GDCMImageIO;
|
||||
using DuplicatorType = itk::ImageDuplicator<InternalImageType>;
|
||||
|
||||
/** Image input resampling Types */
|
||||
using ResampleInputFilterType = itk::ResampleImageFilter<ImageType3D, ImageType3D>;
|
||||
using LinearInterpolatorType = itk::LinearInterpolateImageFunction<ImageType3D, double>;
|
||||
using SizeValueType = ImageType3D::SizeType::SizeValueType;
|
||||
|
||||
/** widely used filters: flip, cast, rescale, ... */
|
||||
using Input2DRescaleFilterType = itk::RescaleIntensityImageFilter<InternalImageType, InternalImageType>;
|
||||
using CastFilterType3D = itk::CastImageFilter<ImageType3D, InternalImageType>;
|
||||
|
Reference in New Issue
Block a user