in the process of removing variables and use meta container
This commit is contained in:
@ -83,6 +83,8 @@ DRTImageMetaInformation(){
|
||||
|
||||
this->m_Origin.Fill(0.);
|
||||
|
||||
this->m_ProjectionAngleLPS = 0.;
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
@ -162,8 +164,8 @@ CTVolumeImageMetaInformation::PointType
|
||||
CTVolumeImageMetaInformation::GetCOV()
|
||||
{
|
||||
|
||||
/* calculate image size in 3D Space by finding the last voxel position */
|
||||
PointType Dest;
|
||||
|
||||
Dest[0]=(m_Size[0]-1) * m_Spacing [0];
|
||||
Dest[1]=(m_Size[1]-1) * m_Spacing [1];
|
||||
Dest[2]=(m_Size[2]-1) * m_Spacing [2];
|
||||
@ -194,6 +196,8 @@ DRTProjectionGeometryImageMetaInformation(){
|
||||
|
||||
this->m_SCD = 0.;
|
||||
|
||||
this->m_IntensityThreshold=0.;
|
||||
|
||||
this->m_ProjectionOriginLPS.Fill(0.);
|
||||
|
||||
this->m_ProjectionOriginLPSZero.Fill(0.);
|
||||
|
@ -122,6 +122,8 @@ public:
|
||||
itkSetMacro(Origin,PointType);
|
||||
itkGetMacro(Origin,PointType);
|
||||
|
||||
itkSetMacro(ProjectionAngleLPS,double);
|
||||
itkGetMacro(ProjectionAngleLPS,double);
|
||||
|
||||
protected:
|
||||
|
||||
@ -135,6 +137,9 @@ protected:
|
||||
PointType
|
||||
m_Origin;
|
||||
|
||||
double
|
||||
m_ProjectionAngleLPS;
|
||||
|
||||
/** Default Constructor **/
|
||||
DRTImageMetaInformation ();
|
||||
/** Default Destructor **/
|
||||
@ -160,7 +165,8 @@ public:
|
||||
typedef itk::Matrix<double, 3, 3> DirectionType;
|
||||
typedef itk::Point<double, 3> PointType;
|
||||
typedef itk::FixedArray<double, 3> SpacingType;
|
||||
typedef itk::FixedArray<unsigned int, 3> SizeType;
|
||||
//typedef itk::FixedArray<unsigned int, 3> SizeType;
|
||||
typedef itk::Size<3> SizeType;
|
||||
|
||||
/** Method for creation through the object factory. */
|
||||
itkNewMacro(Self);
|
||||
@ -184,7 +190,10 @@ public:
|
||||
itkSetMacro(OriginLPS,PointType);
|
||||
itkGetMacro(OriginLPS,PointType);
|
||||
|
||||
itkSetMacro(LPS2IECDirections,DirectionType);
|
||||
itkSetMacro(ImageDirections,DirectionType);
|
||||
itkGetMacro(ImageDirections,DirectionType);
|
||||
|
||||
//itkSetMacro(LPS2IECDirections,DirectionType);
|
||||
itkGetMacro(LPS2IECDirections,DirectionType);
|
||||
|
||||
PointType GetCOV();
|
||||
@ -250,13 +259,15 @@ public:
|
||||
itkSetMacro(SCD, double);
|
||||
itkGetMacro(SCD, double);
|
||||
|
||||
itkSetMacro(IntensityThreshold, double);
|
||||
itkGetMacro(IntensityThreshold, double);
|
||||
|
||||
itkSetMacro(ProjectionOriginLPS,PointType);
|
||||
itkGetMacro(ProjectionOriginLPS,PointType);
|
||||
|
||||
itkSetMacro(ProjectionOriginLPSZero,PointType);
|
||||
itkGetMacro(ProjectionOriginLPSZero,PointType);
|
||||
|
||||
|
||||
itkSetMacro(ProjectionCenter, PointType);
|
||||
itkGetMacro(ProjectionCenter, PointType);
|
||||
|
||||
@ -265,11 +276,14 @@ protected:
|
||||
double
|
||||
m_ProjectionAngle1IEC,
|
||||
m_ProjectionAngle2IEC,
|
||||
m_SCD;
|
||||
m_SCD,
|
||||
m_IntensityThreshold;
|
||||
|
||||
PointType
|
||||
m_ProjectionOriginLPS,
|
||||
m_ProjectionOriginLPSZero,
|
||||
/* center of projection in an IEC reference at
|
||||
* Patient Origin of fixed images. Positioning scanner */
|
||||
m_ProjectionCenter;
|
||||
|
||||
|
||||
|
@ -97,17 +97,11 @@ itkImageProcessor::itkImageProcessor()
|
||||
interpolator1 = InterpolatorType::New();
|
||||
interpolator2 = InterpolatorType::New();
|
||||
|
||||
d_scd = 1000.; // Source to isocenter distance
|
||||
d_intensityThreshold = 0.;
|
||||
projAngle1 = -999.;
|
||||
projAngle2 = -999.;
|
||||
|
||||
image1res[0]=image2res[1]= 2.;
|
||||
image1Size[0] = image1Size[1] = 512;
|
||||
image2Size[0] = image2Size[1] = 512;
|
||||
|
||||
d_image1IntensityWindow[0] = d_image1IntensityWindow[1] = 0.;
|
||||
d_image2IntensityWindow[0] = d_image2IntensityWindow[1] = 0.;
|
||||
|
||||
TZero[0]=TZero[1]=TZero[2]=0.;
|
||||
RZero[0]=RZero[1]=RZero[2]=0.;
|
||||
@ -127,7 +121,7 @@ itkImageProcessor::itkImageProcessor()
|
||||
toVTKLocalizer1 = ITKtoVTKFilterType::New();
|
||||
toVTKLocalizer2 = ITKtoVTKFilterType::New();
|
||||
|
||||
m_3DPatOrientation = eImageOrientationType::NotDefined;
|
||||
// m_3DPatOrientation = eImageOrientationType::NotDefined;
|
||||
|
||||
m_LATSourceDupli = DuplicatorType::New();
|
||||
m_PASourceDupli = DuplicatorType::New();
|
||||
@ -147,7 +141,7 @@ itkImageProcessor::itkImageProcessor()
|
||||
IEC2DCMMapR.Fill(0.);
|
||||
rtIsocenterLPS.Fill(0.);
|
||||
rtCouchOffset.Fill(0.);
|
||||
ProjectionCenterFixedAxes.Fill(0.);
|
||||
//ProjectionCenterFixedAxes.Fill(0.);
|
||||
|
||||
|
||||
m_Projection1VTKTransform = vtkMatrix4x4::New();
|
||||
@ -156,7 +150,21 @@ itkImageProcessor::itkImageProcessor()
|
||||
m_Projection2VTKTransform->Identity();
|
||||
|
||||
|
||||
|
||||
m_CTMetaInfo = NULL;
|
||||
m_TImage1MetaInfo = NULL;
|
||||
m_TImage2MetaInfo = NULL;
|
||||
|
||||
m_DRTGeometryMetaInfo
|
||||
= DRTProjectionGeometryImageMetaInformation::New();
|
||||
m_DRTGeometryMetaInfo->SetSCD(570.);
|
||||
m_DRTGeometryMetaInfo->SetProjectionAngle1IEC(180.);
|
||||
m_DRTGeometryMetaInfo->SetProjectionAngle2IEC(90.);
|
||||
|
||||
m_DRTImage1MetaInfo = DRTImageMetaInformation::New();
|
||||
m_DRTImage2MetaInfo = DRTImageMetaInformation::New();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -172,16 +180,18 @@ void itkImageProcessor::PrintSelf(std::ostream& os, Indent indent) const
|
||||
|
||||
void itkImageProcessor::SetIntensityThreshold(double dT)
|
||||
{
|
||||
d_intensityThreshold = dT;
|
||||
m_DRTGeometryMetaInfo->SetIntensityThreshold(dT);
|
||||
// d_intensityThreshold = dT;
|
||||
}
|
||||
|
||||
void itkImageProcessor::SetSCD(double dDist)
|
||||
{
|
||||
d_scd = dDist;
|
||||
m_DRTGeometryMetaInfo->SetSCD(dDist);
|
||||
}
|
||||
|
||||
double itkImageProcessor::GetSCD(){
|
||||
return d_scd;
|
||||
return
|
||||
m_DRTGeometryMetaInfo->GetSCD();
|
||||
}
|
||||
|
||||
void itkImageProcessor::SetCustom_ImportTransform(double dTx,
|
||||
@ -224,9 +234,16 @@ void itkImageProcessor::SetCustom_ProjectionCenterFixedAxes_IEC(double dX,
|
||||
double dY,
|
||||
double dZ)
|
||||
{
|
||||
ProjectionCenterFixedAxes[0] = dX;
|
||||
ProjectionCenterFixedAxes[1] = dY;
|
||||
ProjectionCenterFixedAxes[2] = dZ;
|
||||
|
||||
typedef itk::Point<double, 3> PointType;
|
||||
PointType m_point;
|
||||
|
||||
m_point [0] = dX;
|
||||
m_point [1] = dY;
|
||||
m_point [2] = dZ;
|
||||
|
||||
m_DRTGeometryMetaInfo->SetProjectionCenter(m_point);
|
||||
|
||||
customized_ProjectionCenter = true;
|
||||
}
|
||||
|
||||
@ -262,6 +279,10 @@ int itkImageProcessor::load3DSerie(const char * pcDirName)
|
||||
nameGenerator->SetGlobalWarningDisplay(false);
|
||||
nameGenerator->SetDirectory(pcDirName);
|
||||
|
||||
|
||||
tPatOrientation m_PatOrientation
|
||||
= tPatOrientation::NotDefined;
|
||||
|
||||
try
|
||||
{
|
||||
using SeriesIdContainer = std::vector<std::string>;
|
||||
@ -337,15 +358,11 @@ int itkImageProcessor::load3DSerie(const char * pcDirName)
|
||||
*std::remove(sTmpString, sTmpString + strlen(sTmpString), ' ') = 0;
|
||||
|
||||
if(!strcmp(sTmpString,ImageOrientationStrings[eImageOrientationType::HFS])){
|
||||
//std::cout<<"Image Orientation: HFS"<<std::endl;
|
||||
m_3DPatOrientation = eImageOrientationType::HFS;
|
||||
m_PatOrientation = eImageOrientationType::HFS;
|
||||
} else if(!strcmp(sTmpString,ImageOrientationStrings[eImageOrientationType::FFS])){
|
||||
//std::cout<<"Image Orientation: FFS"<<std::endl;
|
||||
m_3DPatOrientation = eImageOrientationType::FFS;
|
||||
|
||||
m_PatOrientation = eImageOrientationType::FFS;
|
||||
} else {
|
||||
m_3DPatOrientation = eImageOrientationType::NotDefined;
|
||||
std::cerr<< "Image Orientation: Unrecognised"<< sTmpString <<std::endl;
|
||||
m_PatOrientation = eImageOrientationType::NotDefined;
|
||||
}
|
||||
|
||||
free (sTmpString);
|
||||
@ -353,30 +370,6 @@ int itkImageProcessor::load3DSerie(const char * pcDirName)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* save the current LPS-to-IEC */
|
||||
|
||||
|
||||
for(int iIdx = 0 ; iIdx < 3; iIdx++){
|
||||
for(int jIdx = 0 ; jIdx < 3; jIdx++){
|
||||
|
||||
switch (m_3DPatOrientation) {
|
||||
case eImageOrientationType::HFS:
|
||||
LPStoIEC_Directions.GetVnlMatrix()[iIdx][jIdx] = HFS2IEC[jIdx+iIdx*3];
|
||||
break;
|
||||
case eImageOrientationType::FFS:
|
||||
LPStoIEC_Directions.GetVnlMatrix()[iIdx][jIdx] = FFS2IEC[jIdx+iIdx*3];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Calculate projection angle IEC to LPS */
|
||||
projAngle1 = CalcProjectionAngleLPS(m_3DPatOrientation, projAngle1_IEC);
|
||||
projAngle2 = CalcProjectionAngleLPS(m_3DPatOrientation, projAngle2_IEC);
|
||||
|
||||
|
||||
CastFilterType3D::Pointer caster3D =
|
||||
CastFilterType3D::New();
|
||||
@ -387,30 +380,6 @@ int itkImageProcessor::load3DSerie(const char * pcDirName)
|
||||
m_VolumeSourceDupli->SetInputImage(caster3D->GetOutput());
|
||||
m_VolumeSourceDupli->Update();
|
||||
|
||||
// To simply Siddon-Jacob's fast ray-tracing algorithm, we force the origin of the CT image
|
||||
// to be (0,0,0). Because we align the CT isocenter with the central axis, the projection
|
||||
// geometry is fully defined. The origin of the CT image becomes irrelavent.
|
||||
|
||||
ImageType3D::PointType pZeroOrigin;
|
||||
pZeroOrigin[0] = 0.;
|
||||
pZeroOrigin[1] = 0.;
|
||||
pZeroOrigin[2] = 0.;
|
||||
|
||||
m_3DInputChangeInformationToZero->SetInput(
|
||||
m_VolumeSourceDupli->GetOutput());
|
||||
m_3DInputChangeInformationToZero->SetOutputOrigin(
|
||||
pZeroOrigin);
|
||||
m_3DInputChangeInformationToZero->UpdateOutputInformation();
|
||||
m_3DInputChangeInformationToZero->Update();
|
||||
|
||||
image3DIn =
|
||||
m_3DInputChangeInformationToZero->GetOutput();
|
||||
|
||||
|
||||
/* TODO: Here calculate COV
|
||||
* m_3DProjectionOriginLPSZero
|
||||
* m_3DProjectionOriginLPS */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -420,10 +389,64 @@ int itkImageProcessor::load3DSerie(const char * pcDirName)
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
InternalImageType::Pointer m_InputImage =
|
||||
m_VolumeSourceDupli->GetOutput();
|
||||
|
||||
if(m_CTMetaInfo != NULL){
|
||||
// TODO UNLOAD
|
||||
}
|
||||
|
||||
m_CTMetaInfo = CTVolumeImageMetaInformation::New();
|
||||
m_CTMetaInfo->SetSize(
|
||||
m_InputImage->GetBufferedRegion().GetSize() );
|
||||
m_CTMetaInfo->SetOriginLPS(m_InputImage->GetOrigin());
|
||||
m_CTMetaInfo->SetSpacing(m_InputImage->GetSpacing());
|
||||
m_CTMetaInfo->SetImageDirections(m_InputImage->GetDirection());
|
||||
m_CTMetaInfo->SetPatientOrientation(m_PatOrientation);
|
||||
|
||||
|
||||
|
||||
/* Calculate projection angle IEC to LPS */
|
||||
|
||||
m_DRTImage1MetaInfo->SetProjectionAngleLPS(
|
||||
CalcProjectionAngleLPS(
|
||||
m_CTMetaInfo->GetPatientOrientation(),
|
||||
m_DRTGeometryMetaInfo->GetProjectionAngle1IEC())
|
||||
);
|
||||
|
||||
m_DRTImage2MetaInfo->SetProjectionAngleLPS(
|
||||
CalcProjectionAngleLPS(
|
||||
m_CTMetaInfo->GetPatientOrientation(),
|
||||
m_DRTGeometryMetaInfo->GetProjectionAngle2IEC())
|
||||
);
|
||||
|
||||
|
||||
|
||||
// To simply Siddon-Jacob's fast ray-tracing algorithm, we force the origin of the CT image
|
||||
// to be (0,0,0). Because we align the CT isocenter with the central axis, the projection
|
||||
// geometry is fully defined. The origin of the CT image becomes irrelavent.
|
||||
|
||||
ImageType3D::PointType pZeroOrigin;
|
||||
pZeroOrigin[0] = 0.;
|
||||
pZeroOrigin[1] = 0.;
|
||||
pZeroOrigin[2] = 0.;
|
||||
|
||||
m_3DInputChangeInformationToZero->SetInput(
|
||||
m_VolumeSourceDupli->GetOutput());
|
||||
m_3DInputChangeInformationToZero->SetOutputOrigin(
|
||||
pZeroOrigin);
|
||||
m_3DInputChangeInformationToZero->UpdateOutputInformation();
|
||||
m_3DInputChangeInformationToZero->Update();
|
||||
|
||||
image3DIn =
|
||||
m_3DInputChangeInformationToZero->GetOutput();
|
||||
|
||||
|
||||
/* TODO: Here calculate COV
|
||||
* m_3DProjectionOriginLPSZero
|
||||
* m_3DProjectionOriginLPS */
|
||||
|
||||
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
@ -441,9 +464,10 @@ void itkImageProcessor::ApplyVolumeImportTransform(){
|
||||
if(customized_ImportTransform &&
|
||||
customized_RTCouchSetup &&
|
||||
customized_RTIsocenter ){
|
||||
|
||||
ImportOffset=
|
||||
this->CalcImportVolumeOffset(rtCouchOffset,
|
||||
LPStoIEC_Directions,
|
||||
m_CTMetaInfo->GetLPS2IECDirections(),
|
||||
rtIsocenterLPS,
|
||||
IEC2DCMMapT);
|
||||
std::cout<<"ImportOffset> "<<ImportOffset<<std::endl;
|
||||
@ -470,60 +494,33 @@ void itkImageProcessor::ApplyVolumeImportTransform(){
|
||||
InternalImageType::Pointer m_Image =
|
||||
m_3DInputChangeInformation->GetOutput();
|
||||
|
||||
|
||||
/* before changing origin for projection, let's save the center of volume */
|
||||
using ImageRegionType3D = ImageType3D::RegionType;
|
||||
using SizeType3D = ImageRegionType3D::SizeType;
|
||||
using ImageDirectionType3D = ImageType3D::DirectionType;
|
||||
|
||||
ImageRegionType3D region3D = m_Image->GetBufferedRegion();
|
||||
SizeType3D size3D = region3D.GetSize();
|
||||
// ImageType3D::PointType origin3D = image3DIn->GetOrigin();
|
||||
const itk::Vector<double, 3> resolution3D = m_Image ->GetSpacing();
|
||||
ImageDirectionType3D imagDirection = m_Image ->GetDirection();
|
||||
|
||||
/* 3D volume origin in patient coordinates */
|
||||
m_3DOriginLPS = m_Image ->GetOrigin();
|
||||
|
||||
|
||||
/* calculate image size in 3D Space by finding the last voxel position */
|
||||
using VectorType = itk::Vector<double, 3>;
|
||||
VectorType Dest;
|
||||
Dest[0]=(size3D[0]-1) * resolution3D[0];
|
||||
Dest[1]=(size3D[1]-1) * resolution3D[1];
|
||||
Dest[2]=(size3D[2]-1) * resolution3D[2];
|
||||
|
||||
ImageType3D::PointType LastVoxelPosition =
|
||||
m_3DOriginLPS + (imagDirection * Dest);
|
||||
|
||||
ImageType3D::PointType image3DCOVLPS;
|
||||
image3DCOVLPS[0] = (m_3DOriginLPS[0]+LastVoxelPosition[0])/2;
|
||||
image3DCOVLPS[1] = (m_3DOriginLPS[1]+LastVoxelPosition[1])/2;
|
||||
image3DCOVLPS[2] = (m_3DOriginLPS[2]+LastVoxelPosition[2])/2;
|
||||
|
||||
// TODO: move this view origin to new meta variable.
|
||||
m_CTMetaInfo->SetOriginLPS(m_Image->GetOrigin());
|
||||
|
||||
/* Calculate center of projection in patient coordinates */
|
||||
|
||||
InternalImageType::DirectionType IECtoLPS_Directions;
|
||||
IECtoLPS_Directions = LPStoIEC_Directions.GetTranspose();
|
||||
IECtoLPS_Directions =
|
||||
m_CTMetaInfo->GetLPS2IECDirections().GetTranspose();
|
||||
// LPStoIEC_Directions.GetTranspose();
|
||||
|
||||
if(customized_ProjectionCenter)
|
||||
{
|
||||
m_3DProjectionOriginLPS =
|
||||
IECtoLPS_Directions * ProjectionCenterFixedAxes ;
|
||||
IECtoLPS_Directions * m_DRTGeometryMetaInfo->GetProjectionCenter();
|
||||
/* in longitudinal direction (Sup-Inf), we put it in the
|
||||
* middle of the volume */
|
||||
m_3DProjectionOriginLPS[2] = image3DCOVLPS[2];
|
||||
m_3DProjectionOriginLPS[2] = m_CTMetaInfo->GetCOV()[2];
|
||||
|
||||
} else {
|
||||
m_3DProjectionOriginLPS = image3DCOVLPS;
|
||||
m_3DProjectionOriginLPS = m_CTMetaInfo->GetCOV();
|
||||
}
|
||||
|
||||
|
||||
/* calculate also the same center with zero origin
|
||||
* This is required to bring back the DRT into LPS */
|
||||
m_3DProjectionOriginLPSZero =
|
||||
m_3DProjectionOriginLPS - m_3DOriginLPS;
|
||||
m_3DProjectionOriginLPS - m_CTMetaInfo->GetOriginLPS() ;
|
||||
|
||||
/* We should know everything we need to calculate the
|
||||
* origin and direction of projection images */
|
||||
@ -534,12 +531,12 @@ void itkImageProcessor::ApplyVolumeImportTransform(){
|
||||
|
||||
if(true){
|
||||
std::cout<<" -------- 3D IMAGE --------"<<std::endl;
|
||||
std::cout<<"size3D " <<size3D <<std::endl;
|
||||
std::cout<<"resolution3D " <<resolution3D <<std::endl;
|
||||
std::cout<<"imagDirection " <<imagDirection <<std::endl;
|
||||
std::cout<<"First Voxel position (origin) " <<m_3DOriginLPS <<std::endl;
|
||||
std::cout<<"Last Voxel position: "<<LastVoxelPosition<<std::endl;
|
||||
std::cout<<"Image 3D COV: "<<image3DCOVLPS <<std::endl;
|
||||
// std::cout<<"size3D " <<size3D <<std::endl;
|
||||
// std::cout<<"resolution3D " <<resolution3D <<std::endl;
|
||||
// std::cout<<"imagDirection " <<imagDirection <<std::endl;
|
||||
// std::cout<<"First Voxel position (origin) " <<m_3DOriginLPS <<std::endl;
|
||||
// std::cout<<"Last Voxel position: "<<LastVoxelPosition<<std::endl;
|
||||
std::cout<<"Image 3D COV: "<< m_CTMetaInfo->GetCOV() <<std::endl;
|
||||
std::cout<<"Data collection center LPS: "<<m_3DProjectionOriginLPS <<std::endl;
|
||||
std::cout<<"Data collection center LPS (Zero Origin): "<<m_3DProjectionOriginLPSZero<<std::endl;
|
||||
std::cout<<" -------- -------- --------"<<std::endl;
|
||||
@ -637,21 +634,23 @@ itkImageProcessor::CalcProjectionAngleLPS(
|
||||
|
||||
void itkImageProcessor::SetProjectionAngle1IEC(double dGantryAngle)
|
||||
{
|
||||
projAngle1_IEC = dGantryAngle;
|
||||
m_DRTGeometryMetaInfo->SetProjectionAngle1IEC(dGantryAngle);
|
||||
}
|
||||
|
||||
double itkImageProcessor::GetProjectionAngle1LPS(){
|
||||
|
||||
return projAngle1;
|
||||
return
|
||||
m_DRTImage1MetaInfo->GetProjectionAngleLPS();
|
||||
}
|
||||
|
||||
void itkImageProcessor::SetProjectionAngle2IEC(double dGantryAngle)
|
||||
{
|
||||
projAngle2_IEC= dGantryAngle;
|
||||
m_DRTGeometryMetaInfo->SetProjectionAngle2IEC(dGantryAngle);
|
||||
}
|
||||
|
||||
double itkImageProcessor::GetProjectionAngle2LPS(){
|
||||
return projAngle2;
|
||||
return
|
||||
m_DRTImage2MetaInfo->GetProjectionAngleLPS();
|
||||
}
|
||||
|
||||
int itkImageProcessor::load2D(const char * pcFName){
|
||||
@ -813,24 +812,27 @@ int itkImageProcessor::load2D(const char * pcFName){
|
||||
InternalImageType::Pointer MyLocalizerImage =
|
||||
caster2DInput->GetOutput();
|
||||
|
||||
double* m_ImageIntensity;
|
||||
//double* m_ImageIntensity;
|
||||
DuplicatorType::Pointer m_Duplicator;
|
||||
bool* m_ImLoaded;
|
||||
TopogramImageMetaInformation::Pointer m_TImageMeta;
|
||||
|
||||
switch (currProjOrientation) {
|
||||
case eProjectionOrientationType::PA:
|
||||
|
||||
m_ImageIntensity = d_image1IntensityWindow;
|
||||
//m_ImageIntensity = d_image1IntensityWindow;
|
||||
m_Duplicator = m_PASourceDupli;
|
||||
m_TImageMeta = m_TImage1MetaInfo;
|
||||
// m_ImLoaded = &image2D1Loaded;
|
||||
|
||||
break;
|
||||
|
||||
case eProjectionOrientationType::LAT:
|
||||
|
||||
m_ImageIntensity = d_image2IntensityWindow;
|
||||
//m_ImageIntensity = d_image2IntensityWindow;
|
||||
m_Duplicator = m_LATSourceDupli;
|
||||
// m_ImLoaded = &image2D2Loaded;
|
||||
m_TImageMeta = m_TImage2MetaInfo;
|
||||
|
||||
break;
|
||||
|
||||
@ -839,8 +841,19 @@ int itkImageProcessor::load2D(const char * pcFName){
|
||||
break;
|
||||
}
|
||||
|
||||
if(m_TImageMeta != NULL){
|
||||
//TODO
|
||||
}
|
||||
|
||||
memcpy(m_ImageIntensity,dIntensityWindow, 2*sizeof(double));
|
||||
|
||||
m_TImageMeta = TopogramImageMetaInformation::New();
|
||||
m_TImageMeta->SetWLLevel(dIntensityWindow[0]);
|
||||
m_TImageMeta->SetWLWindow(dIntensityWindow[1]);
|
||||
m_TImageMeta->SetPatientOrientation(
|
||||
currImgOrient);
|
||||
m_TImageMeta->SetProjectionOrientation(
|
||||
currProjOrientation);
|
||||
// memcpy(m_ImageIntensity,dIntensityWindow, 2*sizeof(double));
|
||||
|
||||
m_Duplicator->SetInputImage(caster2DInput->GetOutput() );//filter->GetOutput());
|
||||
m_Duplicator->Update();
|
||||
@ -852,27 +865,69 @@ int itkImageProcessor::load2D(const char * pcFName){
|
||||
}
|
||||
|
||||
|
||||
const double* itkImageProcessor::GetImageIntensityWindow(int iImg)
|
||||
double itkImageProcessor::GetLocalizerDisplayWindowLevel(int iImg)
|
||||
{
|
||||
|
||||
|
||||
TopogramImageMetaInformation::Pointer m_TImageMeta;
|
||||
|
||||
switch (iImg) {
|
||||
|
||||
case 0:
|
||||
return d_image1IntensityWindow;
|
||||
break;
|
||||
case 0:
|
||||
m_TImageMeta = m_TImage1MetaInfo;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
return d_image2IntensityWindow;
|
||||
break;
|
||||
case 1:
|
||||
m_TImageMeta = m_TImage2MetaInfo;
|
||||
|
||||
default:
|
||||
return nullptr;
|
||||
break;
|
||||
break;
|
||||
|
||||
}
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if(m_TImageMeta == NULL){
|
||||
return 0;
|
||||
} else {
|
||||
return
|
||||
m_TImageMeta->GetWLLevel();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
double itkImageProcessor::GetLocalizerDisplayWindowWidth(int iImg)
|
||||
{
|
||||
TopogramImageMetaInformation::Pointer m_TImageMeta;
|
||||
|
||||
switch (iImg) {
|
||||
|
||||
case 0:
|
||||
m_TImageMeta = m_TImage1MetaInfo;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
m_TImageMeta = m_TImage2MetaInfo;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if(m_TImageMeta == NULL){
|
||||
return 0;
|
||||
} else {
|
||||
return
|
||||
m_TImageMeta->GetWLWindow();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void itkImageProcessor::InitializeProjector()
|
||||
{
|
||||
@ -894,17 +949,28 @@ void itkImageProcessor::InitializeProjector()
|
||||
transform->SetCenter(m_3DProjectionOriginLPSZero);
|
||||
|
||||
// 2D Image 1
|
||||
interpolator1->SetProjectionAngle(dtr * projAngle1);
|
||||
interpolator1->SetFocalPointToIsocenterDistance(d_scd);
|
||||
interpolator1->SetThreshold(d_intensityThreshold);
|
||||
interpolator1->SetProjectionAngle(
|
||||
dtr *
|
||||
m_DRTImage1MetaInfo->GetProjectionAngleLPS() );
|
||||
interpolator1->SetFocalPointToIsocenterDistance(
|
||||
m_DRTGeometryMetaInfo->GetSCD());
|
||||
interpolator1->SetThreshold(
|
||||
m_DRTGeometryMetaInfo->GetIntensityThreshold()
|
||||
);
|
||||
|
||||
interpolator1->SetTransform(transform);
|
||||
|
||||
interpolator1->Initialize();
|
||||
|
||||
// 2D Image 2
|
||||
interpolator2->SetProjectionAngle(dtr * projAngle2);
|
||||
interpolator2->SetFocalPointToIsocenterDistance(d_scd);
|
||||
interpolator2->SetThreshold(d_intensityThreshold);
|
||||
interpolator2->SetProjectionAngle(
|
||||
dtr *
|
||||
m_DRTImage2MetaInfo->GetProjectionAngleLPS() );
|
||||
interpolator2->SetFocalPointToIsocenterDistance(
|
||||
m_DRTGeometryMetaInfo->GetSCD());
|
||||
interpolator2->SetThreshold(
|
||||
m_DRTGeometryMetaInfo->GetIntensityThreshold()
|
||||
);
|
||||
interpolator2->SetTransform(transform);
|
||||
|
||||
interpolator2->Initialize();
|
||||
@ -1043,7 +1109,7 @@ void itkImageProcessor::GetProjectionImages(){
|
||||
// Compute the origin (in mm) of the 2D Image
|
||||
origin[0] = -image1res[0] * o2Dx;
|
||||
origin[1] = -image1res[1] * o2Dy;
|
||||
origin[2] = -d_scd;
|
||||
origin[2] = -m_DRTGeometryMetaInfo->GetSCD();
|
||||
|
||||
resampleFilter1->SetSize(size);
|
||||
resampleFilter1->SetOutputSpacing(spacing);
|
||||
@ -1079,7 +1145,7 @@ void itkImageProcessor::GetProjectionImages(){
|
||||
// Compute the origin (in mm) of the 2D Image
|
||||
origin[0] = -image2res[0] * o2Dx;
|
||||
origin[1] = -image2res[1] * o2Dy;
|
||||
origin[2] = -d_scd;
|
||||
origin[2] = -m_DRTGeometryMetaInfo->GetSCD();
|
||||
|
||||
resampleFilter2->SetSize(size);
|
||||
resampleFilter2->SetOutputSpacing(spacing);
|
||||
@ -1116,11 +1182,12 @@ void itkImageProcessor::GetProjectionImages(){
|
||||
ImageType3D::PointType NewOrigin =
|
||||
this->CalcDRTImageOrigin(resampleFilter1->GetOutput(),
|
||||
m_3DProjectionOriginLPS,
|
||||
projAngle1,
|
||||
m_DRTImage1MetaInfo->GetProjectionAngleLPS(),
|
||||
Std_DRT2LPS);
|
||||
InternalImageType::DirectionType DRT2LPS1 =
|
||||
this->CalcDRTImageDirections(projAngle1,
|
||||
Std_DRT2LPS);
|
||||
this->CalcDRTImageDirections(
|
||||
m_DRTImage1MetaInfo->GetProjectionAngleLPS(),
|
||||
Std_DRT2LPS);
|
||||
|
||||
filter1->SetInput( resampleFilter1->GetOutput() );
|
||||
filter1->SetOutputDirection(DRT2LPS1 );//IECtoLPS_Directions);
|
||||
@ -1137,11 +1204,12 @@ void itkImageProcessor::GetProjectionImages(){
|
||||
NewOrigin =
|
||||
this->CalcDRTImageOrigin(resampleFilter2->GetOutput(),
|
||||
m_3DProjectionOriginLPS,
|
||||
projAngle2,
|
||||
m_DRTImage2MetaInfo->GetProjectionAngleLPS(),
|
||||
Std_DRT2LPS);
|
||||
|
||||
DRT2LPS1 =
|
||||
this->CalcDRTImageDirections(projAngle2,
|
||||
this->CalcDRTImageDirections(
|
||||
m_DRTImage2MetaInfo->GetProjectionAngleLPS(),
|
||||
Std_DRT2LPS);
|
||||
|
||||
|
||||
@ -1617,7 +1685,9 @@ void itkImageProcessor::SetInitialTranslations(double dX, double dY, double dZ)
|
||||
|
||||
InternalImageType::DirectionType IECtoLPS_Directions;
|
||||
|
||||
IECtoLPS_Directions = LPStoIEC_Directions.GetTranspose();
|
||||
IECtoLPS_Directions =
|
||||
m_CTMetaInfo->GetLPS2IECDirections().GetTranspose();
|
||||
// LPStoIEC_Directions.GetTranspose();
|
||||
|
||||
ImageType3D::PointType LPSTranslations =
|
||||
IECtoLPS_Directions * IECTranslations;
|
||||
|
@ -123,7 +123,8 @@ public:
|
||||
|
||||
/** Get the Localizer intensity window and
|
||||
* center for rendering */
|
||||
const double *GetImageIntensityWindow(int );
|
||||
double GetLocalizerDisplayWindowLevel(int );
|
||||
double GetLocalizerDisplayWindowWidth(int );
|
||||
|
||||
/** Compute Digital Localizers */
|
||||
void GetProjectionImages();
|
||||
@ -157,10 +158,6 @@ protected:
|
||||
virtual ~itkImageProcessor();
|
||||
void PrintSelf(std::ostream& os, itk::Indent indent) const;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
itkImageProcessor(const Self&); //purposely not implemented
|
||||
void operator=(const Self&); //purposely not implemented
|
||||
@ -225,16 +222,10 @@ ImageType3D::PointType ImportOffset;
|
||||
ChangeInformationFilterType::Pointer
|
||||
m_3DInputChangeInformationToZero;
|
||||
|
||||
tPatOrientation
|
||||
m_3DPatOrientation;
|
||||
|
||||
ImageType3D :: PointType
|
||||
m_3DOriginLPS,
|
||||
m_3DProjectionOriginLPS,
|
||||
m_3DProjectionOriginLPSZero;
|
||||
|
||||
InternalImageType::DirectionType
|
||||
LPStoIEC_Directions;
|
||||
|
||||
/* The following functions do not rely on class variables,
|
||||
* Only input variables are used... */
|
||||
@ -265,13 +256,6 @@ ImageType3D::PointType ImportOffset;
|
||||
double image1res[2], image2res[2];
|
||||
int image1Size[2], image2Size[2];
|
||||
|
||||
double
|
||||
d_scd,
|
||||
d_intensityThreshold;
|
||||
|
||||
double projAngle1, projAngle2;
|
||||
double projAngle1_IEC, projAngle2_IEC;
|
||||
|
||||
double TZero[3], RZero[3];
|
||||
|
||||
|
||||
@ -288,9 +272,7 @@ ImageType3D::PointType ImportOffset;
|
||||
image2D2Loaded,
|
||||
image3DLoaded;
|
||||
|
||||
double
|
||||
d_image1IntensityWindow[2],
|
||||
d_image2IntensityWindow[2];
|
||||
|
||||
|
||||
/* Transform between IEC Support and
|
||||
* IEC Scanner frame of reference */
|
||||
@ -307,10 +289,7 @@ ImageType3D::PointType ImportOffset;
|
||||
ImageType3D::PointType
|
||||
rtCouchOffset;
|
||||
|
||||
/* center of projection in an IEC reference at
|
||||
* Patient Origin of fixed images. Positioning scanner */
|
||||
ImageType3D::PointType
|
||||
ProjectionCenterFixedAxes;
|
||||
|
||||
|
||||
InternalImageType::DirectionType
|
||||
Std_DRT2LPS;
|
||||
@ -325,6 +304,16 @@ ImageType3D::PointType ImportOffset;
|
||||
CTVolumeImageMetaInformation::Pointer
|
||||
m_CTMetaInfo;
|
||||
|
||||
DRTProjectionGeometryImageMetaInformation::Pointer
|
||||
m_DRTGeometryMetaInfo;
|
||||
|
||||
DRTImageMetaInformation::Pointer
|
||||
m_DRTImage1MetaInfo,
|
||||
m_DRTImage2MetaInfo;
|
||||
|
||||
TopogramImageMetaInformation::Pointer
|
||||
m_TImage1MetaInfo,
|
||||
m_TImage2MetaInfo;
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user