Merge branch 'ScalarRangeDRT' into 'ScoutRTRelease'
Scalar Range of DRT for writing See merge request cpt_bioeng/drt!57
This commit is contained in:
@ -2127,14 +2127,13 @@ void itkImageProcessor::Write2DImages(){
|
||||
|
||||
vtkImageData* itkImageProcessor::GetLocalizer1VTK()
|
||||
{
|
||||
// Rescale the intensity of the projection images to 0-32768 for output.
|
||||
|
||||
using RescaleFilterType = itk::RescaleIntensityImageFilter<InternalImageType, OutputImageType>;
|
||||
|
||||
RescaleFilterType::Pointer rescaler1 = RescaleFilterType::New();
|
||||
rescaler1->SetOutputMinimum(0);
|
||||
rescaler1->SetOutputMaximum(32768);
|
||||
rescaler1->SetInput(m_PASourceDupli->GetOutput());
|
||||
|
||||
rescaler1->SetOutputMaximum(IMG_VIS_MAXIMUM_RANGE);
|
||||
rescaler1->SetInput( m_PASourceDupli->GetOutput() );
|
||||
rescaler1->Update();
|
||||
|
||||
toVTKLocalizer1->SetInput(rescaler1->GetOutput());
|
||||
@ -2187,22 +2186,18 @@ vtkImageData* itkImageProcessor::GetLocalizer1VTK()
|
||||
vtkImageData* itkImageProcessor::GetLocalizer2VTK()
|
||||
{
|
||||
|
||||
|
||||
// Rescale the intensity of the projection images to 0-32768 for output.
|
||||
using RescaleFilterType = itk::RescaleIntensityImageFilter<InternalImageType, OutputImageType>;
|
||||
|
||||
RescaleFilterType::Pointer rescaler2 = RescaleFilterType::New();
|
||||
rescaler2->SetOutputMinimum(0);
|
||||
rescaler2->SetOutputMaximum(32768);
|
||||
rescaler2->SetInput(m_LATSourceDupli ->GetOutput());
|
||||
|
||||
rescaler2->SetOutputMaximum(IMG_VIS_MAXIMUM_RANGE);
|
||||
rescaler2->SetInput( m_LATSourceDupli->GetOutput() );
|
||||
rescaler2->Update();
|
||||
|
||||
toVTKLocalizer2->SetInput(rescaler2->GetOutput());
|
||||
toVTKLocalizer2->Update();
|
||||
|
||||
|
||||
|
||||
// if(true) {
|
||||
// using ImageRegionType3D = ImageType3D::RegionType;
|
||||
// using SizeType3D = ImageRegionType3D::SizeType;
|
||||
@ -2246,6 +2241,7 @@ vtkImageData* itkImageProcessor::GetLocalizer2VTK()
|
||||
toVTKLocalizer2->GetOutput();
|
||||
}
|
||||
|
||||
|
||||
vtkImageData* itkImageProcessor::GetProjection1VTK()
|
||||
{
|
||||
|
||||
@ -2256,33 +2252,60 @@ vtkImageData* itkImageProcessor::GetProjection1VTK()
|
||||
//TODO
|
||||
}
|
||||
|
||||
// Rescale the intensity of the projection images from float to unsigned short for output.
|
||||
using RescaleFilterType = itk::RescaleIntensityImageFilter<InternalImageType, OutputImageType>;
|
||||
|
||||
RescaleFilterType::Pointer rescaler1 = RescaleFilterType::New();
|
||||
rescaler1->SetOutputMinimum(0);
|
||||
rescaler1->SetOutputMaximum(USHRT_MAX);
|
||||
rescaler1->SetOutputMaximum(IMG_VIS_MAXIMUM_RANGE);
|
||||
rescaler1->SetInput( imageDRT1In );
|
||||
rescaler1->Update();
|
||||
|
||||
// using ImageCalculatorFilterType = itk::MinimumMaximumImageCalculator<InternalImageType>;
|
||||
// auto imageCalculatorFilter = ImageCalculatorFilterType::New();
|
||||
// imageCalculatorFilter->SetImage(imageDRT1In);
|
||||
// imageCalculatorFilter->Compute();
|
||||
|
||||
// std::cout<< "itkImageProcessor::imageDRT1In() " <<
|
||||
// imageCalculatorFilter <<std::endl;
|
||||
|
||||
// using ImageCalculatorFilterType2 = itk::MinimumMaximumImageCalculator<OutputImageType>;
|
||||
// auto imageCalculatorFilter2 = ImageCalculatorFilterType2::New();
|
||||
// imageCalculatorFilter2->SetImage(rescaler1->GetOutput());
|
||||
// imageCalculatorFilter2->Compute();
|
||||
// std::cout<< "itkImageProcessor::imageDRT2In() " <<
|
||||
// imageCalculatorFilter2 <<std::endl;
|
||||
|
||||
toVTK2D1->SetInput(rescaler1->GetOutput());
|
||||
toVTK2D1->Update();
|
||||
|
||||
return
|
||||
toVTK2D1->GetOutput();
|
||||
}
|
||||
|
||||
vtkImageData* itkImageProcessor::GetProjection1VTKToWrite()
|
||||
{
|
||||
|
||||
if(m_DRTImage1MetaInfo == NULL ||
|
||||
m_DRTGeometryMetaInfo == NULL ||
|
||||
m_TransformMetaInfo == NULL ){
|
||||
return NULL;
|
||||
//TODO
|
||||
}
|
||||
|
||||
using ImageCalculatorFilterType = itk::MinimumMaximumImageCalculator<InternalImageType>;
|
||||
auto imageCalculatorFilter = ImageCalculatorFilterType::New();
|
||||
imageCalculatorFilter->SetImage(imageDRT1In);
|
||||
imageCalculatorFilter->Compute();
|
||||
|
||||
using IntWindowType = itk::IntensityWindowingImageFilter<InternalImageType, OutputImageType>;
|
||||
auto intWindowFilter = IntWindowType::New();
|
||||
intWindowFilter->SetWindowMinimum(imageCalculatorFilter->GetMinimum());
|
||||
intWindowFilter->SetWindowMaximum(imageCalculatorFilter->GetMaximum());
|
||||
|
||||
intWindowFilter->SetOutputMinimum(0);
|
||||
if(imageCalculatorFilter->GetMaximum() > SHRT_MAX){
|
||||
intWindowFilter->SetOutputMaximum(SHRT_MAX);
|
||||
}else
|
||||
intWindowFilter->SetOutputMaximum(imageCalculatorFilter->GetMaximum());
|
||||
|
||||
|
||||
intWindowFilter->SetInput(imageDRT1In);
|
||||
intWindowFilter->Update();
|
||||
|
||||
toVTK2D1->SetInput(intWindowFilter->GetOutput());
|
||||
toVTK2D1->Update();
|
||||
|
||||
// using ImageCalculatorFilterType2 = itk::MinimumMaximumImageCalculator<OutputImageType>;
|
||||
// auto imageCalculatorFilter2 = ImageCalculatorFilterType2::New();
|
||||
// imageCalculatorFilter2->SetImage(intWindowFilter->GetOutput());
|
||||
// imageCalculatorFilter2->Compute();
|
||||
// std::cout<< "itkImageProcessor::imageCalculatorFilter2() " <<
|
||||
// imageCalculatorFilter2->GetMinimum() << " " << imageCalculatorFilter2->GetMaximum() <<std::endl;
|
||||
|
||||
// using ImageRegionType3D = ImageType3D::RegionType;
|
||||
// using SizeType3D = ImageRegionType3D::SizeType;
|
||||
@ -2387,19 +2410,63 @@ vtkImageData* itkImageProcessor::GetProjection2VTK()
|
||||
//TODO
|
||||
}
|
||||
|
||||
// Rescale the intensity of the projection images from float to unsigned short for output.
|
||||
|
||||
using RescaleFilterType = itk::RescaleIntensityImageFilter<InternalImageType, OutputImageType>;
|
||||
|
||||
RescaleFilterType::Pointer rescaler2 = RescaleFilterType::New();
|
||||
rescaler2->SetOutputMinimum(0);
|
||||
rescaler2->SetOutputMaximum(USHRT_MAX);
|
||||
rescaler2->SetOutputMaximum(IMG_VIS_MAXIMUM_RANGE);
|
||||
rescaler2->SetInput( imageDRT2In );
|
||||
|
||||
rescaler2->Update();
|
||||
|
||||
toVTK2D2->SetInput(rescaler2->GetOutput());
|
||||
toVTK2D2->Update();
|
||||
|
||||
// rescaler2->Print(std::cout);
|
||||
return
|
||||
toVTK2D2->GetOutput();
|
||||
}
|
||||
|
||||
|
||||
|
||||
vtkImageData* itkImageProcessor::GetProjection2VTKToWrite()
|
||||
{
|
||||
if(m_DRTImage2MetaInfo == NULL ||
|
||||
m_DRTGeometryMetaInfo == NULL ||
|
||||
m_TransformMetaInfo == NULL ){
|
||||
return NULL;
|
||||
//TODO
|
||||
}
|
||||
|
||||
using ImageCalculatorFilterType = itk::MinimumMaximumImageCalculator<InternalImageType>;
|
||||
auto imageCalculatorFilter = ImageCalculatorFilterType::New();
|
||||
imageCalculatorFilter->SetImage(imageDRT2In);
|
||||
imageCalculatorFilter->Compute();
|
||||
|
||||
using IntWindowType = itk::IntensityWindowingImageFilter<InternalImageType, OutputImageType>;
|
||||
auto intWindowFilter = IntWindowType::New();
|
||||
intWindowFilter->SetWindowMinimum(imageCalculatorFilter->GetMinimum());
|
||||
intWindowFilter->SetWindowMaximum(imageCalculatorFilter->GetMaximum());
|
||||
|
||||
intWindowFilter->SetOutputMinimum(0);
|
||||
if(imageCalculatorFilter->GetMaximum() > SHRT_MAX)
|
||||
intWindowFilter->SetOutputMaximum(SHRT_MAX);
|
||||
else
|
||||
intWindowFilter->SetOutputMaximum(imageCalculatorFilter->GetMaximum());
|
||||
|
||||
|
||||
intWindowFilter->SetInput(imageDRT2In);
|
||||
intWindowFilter->Update();
|
||||
|
||||
|
||||
toVTK2D2->SetInput(intWindowFilter->GetOutput());
|
||||
toVTK2D2->Update();
|
||||
|
||||
// using ImageCalculatorFilterType2 = itk::MinimumMaximumImageCalculator<OutputImageType>;
|
||||
// auto imageCalculatorFilter2 = ImageCalculatorFilterType2::New();
|
||||
// imageCalculatorFilter2->SetImage(intWindowFilter->GetOutput());
|
||||
// imageCalculatorFilter2->Compute();
|
||||
// std::cout<< "itkImageProcessor::imageCalculatorFilter2() " <<
|
||||
// imageCalculatorFilter2->GetMinimum() << " " << imageCalculatorFilter2->GetMaximum() <<std::endl;
|
||||
|
||||
// using ImageRegionType3D = ImageType3D::RegionType;
|
||||
// using SizeType3D = ImageRegionType3D::SizeType;
|
||||
|
@ -22,6 +22,7 @@ gfattori 08.11.2021
|
||||
#include "itkResampleImageFilter.h"
|
||||
#include "itkCastImageFilter.h"
|
||||
#include "itkRescaleIntensityImageFilter.h"
|
||||
#include "itkIntensityWindowingImageFilter.h"
|
||||
#include "itkChangeInformationImageFilter.h"
|
||||
#include "itkGDCMImageIO.h"
|
||||
#include "itkMetaDataObject.h"
|
||||
@ -49,6 +50,8 @@ gfattori 08.11.2021
|
||||
#include "itkReg23.h"
|
||||
#include "itkReg23MetaInformation.h"
|
||||
|
||||
#define IMG_VIS_MAXIMUM_RANGE 2048
|
||||
|
||||
namespace itk
|
||||
{
|
||||
|
||||
@ -242,6 +245,10 @@ public:
|
||||
vtkImageData* GetProjection1VTK();
|
||||
vtkImageData* GetProjection2VTK();
|
||||
|
||||
/** Conveniency methods to get VTK images for rendering */
|
||||
vtkImageData* GetProjection1VTKToWrite();
|
||||
vtkImageData* GetProjection2VTKToWrite();
|
||||
|
||||
vtkImageData* GetLocalizer1VTK();
|
||||
vtkImageData* GetLocalizer2VTK();
|
||||
|
||||
|
@ -139,6 +139,7 @@ gSiddonJacobsRayCastInterpolateImageFunction<TInputImage, TCoordRep>::Evaluate(c
|
||||
const OutputType minOutputValue = itk::NumericTraits<OutputType>::NonpositiveMin();
|
||||
const OutputType maxOutputValue = itk::NumericTraits<OutputType>::max();
|
||||
|
||||
|
||||
// If the volume was shifted, recalculate the overall inverse transform
|
||||
unsigned long int interpMTime = this->GetMTime();
|
||||
unsigned long int vTransformMTime = m_Transform->GetMTime();
|
||||
|
Reference in New Issue
Block a user