backup current stage

This commit is contained in:
2022-03-18 17:02:06 +01:00
parent c08dba7cf0
commit 496bb08c27
4 changed files with 878 additions and 327 deletions

View File

@ -80,7 +80,7 @@ DRTImageMetaInformation(){
this->m_Spacing.Fill(0.); this->m_Spacing.Fill(0.);
this->m_Origin.Fill(0.); //this->m_Origin.Fill(0.);
this->m_ProjectionOriginLPS.Fill(0.); this->m_ProjectionOriginLPS.Fill(0.);
@ -111,6 +111,98 @@ DRTImageMetaInformation
} }
DRTImageMetaInformation::PointType
DRTImageMetaInformation::GetOrigin()
{
//PointType Origin;
PointType Origin;
double o2Dx, o2Dy;
o2Dx = ((double)this->m_Size[0] - 1.) / 2.;
o2Dy = ((double)this->m_Size[1] - 1.) / 2.;
// Compute the origin (in mm) of the 2D Image
Origin[0] = -(this->m_Spacing[0]) * o2Dx;
Origin[1] = -(this->m_Spacing[1]) * o2Dy;
Origin[2] = -(this->m_SCD) ;
return
Origin;
}
void DRTImageMetaInformation::SetSizeWithBounds(
double* dBounds,
SizeType MaxSize,
SpacingType Spacing)
{
double dXmin = dBounds[0];
double dYmin = dBounds[1];
double dZmin = dBounds[2];
double dXmax = dBounds[3];
double dYmax = dBounds[4];
double dZmax = dBounds[5];
double
dNPixMin1 = 0.,
dNPixMin2 = 0.,
dNPixMax1 = 0.,
dNPixMax2 = 0.;
dNPixMin1 = abs(dXmin / Spacing[0]);
dNPixMin2 = abs(dYmin / Spacing[0]);
dNPixMax1 = abs(dXmax / Spacing[0]);
dNPixMax2 = abs(dYmax / Spacing[0]);
double dPixMaxOverlap =dNPixMin1;
if(dPixMaxOverlap > dNPixMin2){
dPixMaxOverlap = dNPixMin2;
}
if(dPixMaxOverlap > dNPixMax1){
dPixMaxOverlap = dNPixMax1;
}
if(dPixMaxOverlap > dNPixMax2){
dPixMaxOverlap = dNPixMax2;
}
if(floor(dPixMaxOverlap*2) > MaxSize[0]) {
m_Size[0] = MaxSize[0];
} else {
m_Size[0] = floor(dPixMaxOverlap*2);
}
dNPixMin1 = abs(dZmin / Spacing[1]);
dNPixMax1 = abs(dZmax / Spacing[1]);
dPixMaxOverlap =dNPixMin1;
if(dPixMaxOverlap > dNPixMax1){
dPixMaxOverlap = dNPixMax1;
}
if(floor(dPixMaxOverlap*2) > MaxSize[1]) {
m_Size[1] = MaxSize[1];
} else {
m_Size[1] = floor(dPixMaxOverlap*2);
}
m_Size[2] = 1;
m_Spacing = Spacing;
return;
}
DRTImageMetaInformation::PointType DRTImageMetaInformation::PointType
DRTImageMetaInformation::GetLPStoProjectionGeoLPSOffset() DRTImageMetaInformation::GetLPStoProjectionGeoLPSOffset()
{ {
@ -137,19 +229,117 @@ DRTImageMetaInformation ::GetCOV()
PointType LastVoxelPosition = Dest; PointType LastVoxelPosition = Dest;
LastVoxelPosition [0] += m_Origin[0]; PointType Origin = this->GetOrigin();
LastVoxelPosition [1] += m_Origin[1]; LastVoxelPosition [0] += Origin[0];
LastVoxelPosition [2] += m_Origin[2]; LastVoxelPosition [1] += Origin[1];
LastVoxelPosition [2] += Origin[2];
PointType image3DCOV; PointType image3DCOV;
image3DCOV[0] = (m_Origin [0] + LastVoxelPosition[0])/2.; image3DCOV[0] = (Origin [0] + LastVoxelPosition[0])/2.;
image3DCOV[1] = (m_Origin [1] + LastVoxelPosition[1])/2.; image3DCOV[1] = (Origin [1] + LastVoxelPosition[1])/2.;
image3DCOV[2] = (m_Origin [2] + LastVoxelPosition[2])/2.; image3DCOV[2] = (Origin [2] + LastVoxelPosition[2])/2.;
return return
image3DCOV; image3DCOV;
} }
CTVolumeImageMetaInformation::PointType
CTVolumeImageMetaInformation::ConvertIECPointToLPSPoint(
PointType IECPoint){
DirectionType IECtoLPS_Directions;
IECtoLPS_Directions = this->m_LPS2IECDirections.GetTranspose();
PointType m_LPSPoint;
m_LPSPoint =
IECtoLPS_Directions * IECPoint;
return
m_LPSPoint;
}
CTVolumeImageMetaInformation::PointType
CTVolumeImageMetaInformation::GetProjectionOriginLPS(
PointType ProjectionCenter)
{
// PointType Origin;
// Origin = this->m_OriginLPS;
// Origin = Origin - this->m_ImportOffset;
DirectionType IECtoLPS_Directions;
IECtoLPS_Directions = this->m_LPS2IECDirections.GetTranspose();
PointType m_ProjectionOriginLPS;
m_ProjectionOriginLPS =
IECtoLPS_Directions * ProjectionCenter;
/* in longitudinal direction (Sup-Inf), we put it in the
* middle of the volume */
m_ProjectionOriginLPS[2] = this->GetCOV()[2] - this->m_ImportOffset[2];
return
m_ProjectionOriginLPS;
}
CTVolumeImageMetaInformation::PointType
CTVolumeImageMetaInformation::GetProjectionOriginLPSZero(
PointType ProjectionCenter)
{
PointType Origin;
Origin = this->m_OriginLPS;
Origin = Origin - this->m_ImportOffset;
DirectionType IECtoLPS_Directions;
IECtoLPS_Directions = this->m_LPS2IECDirections.GetTranspose();
PointType m_ProjectionOriginLPS;
m_ProjectionOriginLPS =
IECtoLPS_Directions * ProjectionCenter;
/* in longitudinal direction (Sup-Inf), we put it in the
* middle of the volume */
m_ProjectionOriginLPS[2] = this->GetCOV()[2] - this->m_ImportOffset[2];
return
m_ProjectionOriginLPS - Origin;
}
const std::vector<double>
CTVolumeImageMetaInformation::CalculateRegions(PointType pProjectionOriginLPS)
{
/* 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];
PointType LastVoxelPosition =
(m_ImageDirections * Dest);
LastVoxelPosition [0] += m_OriginLPS[0];
LastVoxelPosition [1] += m_OriginLPS[1];
LastVoxelPosition [2] += m_OriginLPS[2];
std::vector <double> vBounds;
vBounds.clear();
vBounds.push_back( pProjectionOriginLPS[0] - LastVoxelPosition [0] );
vBounds.push_back( pProjectionOriginLPS[1] - LastVoxelPosition [1] );
vBounds.push_back( pProjectionOriginLPS[2] - LastVoxelPosition [2] );
vBounds.push_back( pProjectionOriginLPS[0] - m_OriginLPS [0] );
vBounds.push_back( pProjectionOriginLPS[1] - m_OriginLPS [1] );
vBounds.push_back( pProjectionOriginLPS[2] - m_OriginLPS [2] );
return
vBounds;
}
CTVolumeImageMetaInformation:: CTVolumeImageMetaInformation::
CTVolumeImageMetaInformation(){ CTVolumeImageMetaInformation(){
@ -250,7 +440,17 @@ DRTProjectionGeometryImageMetaInformation(){
this->m_ProjectionAngle2IEC = 0.; this->m_ProjectionAngle2IEC = 0.;
this->m_SCD = 0.; this->m_ProjectionAngle1OffsetIEC = 0.;
this->m_ProjectionAngle2OffsetIEC = 0.;
this->m_SCD1 = 0.;
this->m_SCD2 = 0.;
this->m_SCD1Offset = 0.;
this->m_SCD2Offset = 0.;
this->m_IntensityThreshold=0.; this->m_IntensityThreshold=0.;
@ -266,6 +466,10 @@ DRTProjectionGeometryImageMetaInformation(){
this->m_IECS2IECScannerR.Fill(0.); this->m_IECS2IECScannerR.Fill(0.);
this->m_ProjectionCenterOffset1.Fill(0.);
this->m_ProjectionCenterOffset2.Fill(0.);
this->m_ProjectionCenter.Fill(0.); this->m_ProjectionCenter.Fill(0.);
} }

View File

@ -117,8 +117,8 @@ public:
itkSetMacro(Spacing,SpacingType); itkSetMacro(Spacing,SpacingType);
itkGetMacro(Spacing,SpacingType); itkGetMacro(Spacing,SpacingType);
itkSetMacro(Origin,PointType); //itkSetMacro(Origin,PointType);
itkGetMacro(Origin,PointType); //itkGetMacro(Origin,PointType);
itkSetMacro(OriginLPS,PointType); itkSetMacro(OriginLPS,PointType);
itkGetMacro(OriginLPS,PointType); itkGetMacro(OriginLPS,PointType);
@ -141,6 +141,10 @@ public:
PointType GetCOV(); PointType GetCOV();
PointType GetLPStoProjectionGeoLPSOffset(); PointType GetLPStoProjectionGeoLPSOffset();
void SetSizeWithBounds(double*, SizeType, SpacingType);
PointType GetOrigin();
protected: protected:
SizeType SizeType
@ -150,7 +154,7 @@ protected:
m_Spacing; m_Spacing;
PointType PointType
m_Origin, //m_Origin,
m_OriginLPS, m_OriginLPS,
m_ProjectionOriginLPS, m_ProjectionOriginLPS,
m_ProjectionOriginLPSZero; m_ProjectionOriginLPSZero;
@ -222,6 +226,18 @@ public:
PointType GetCOV(); PointType GetCOV();
PointType GetOriginWOffset(); PointType GetOriginWOffset();
const std::vector <double> CalculateRegions(PointType pProjectionOriginLPS);
PointType ConvertIECPointToLPSPoint(
PointType IECPoint);
PointType GetProjectionOriginLPS(
PointType ProjectionCenter);
PointType GetProjectionOriginLPSZero(
PointType ProjectionCenter);
protected: protected:
tPatOrientation tPatOrientation
@ -283,8 +299,23 @@ public:
itkSetMacro(ProjectionAngle2IEC, double); itkSetMacro(ProjectionAngle2IEC, double);
itkGetMacro(ProjectionAngle2IEC, double); itkGetMacro(ProjectionAngle2IEC, double);
itkSetMacro(SCD, double); itkSetMacro(ProjectionAngle1OffsetIEC, double);
itkGetMacro(SCD, double); itkGetMacro(ProjectionAngle1OffsetIEC, double);
itkSetMacro(ProjectionAngle2OffsetIEC, double);
itkGetMacro(ProjectionAngle2OffsetIEC, double);
itkSetMacro(SCD1, double);
itkGetMacro(SCD1, double);
itkSetMacro(SCD2, double);
itkGetMacro(SCD2, double);
itkSetMacro(SCD1Offset, double);
itkGetMacro(SCD1Offset, double);
itkSetMacro(SCD2Offset, double);
itkGetMacro(SCD2Offset, double);
itkSetMacro(IntensityThreshold, double); itkSetMacro(IntensityThreshold, double);
itkGetMacro(IntensityThreshold, double); itkGetMacro(IntensityThreshold, double);
@ -307,6 +338,12 @@ public:
itkSetMacro(IECS2IECScannerR, PointType); itkSetMacro(IECS2IECScannerR, PointType);
itkGetMacro(IECS2IECScannerR, PointType); itkGetMacro(IECS2IECScannerR, PointType);
itkSetMacro(ProjectionCenterOffset1, PointType);
itkGetMacro(ProjectionCenterOffset1, PointType);
itkSetMacro(ProjectionCenterOffset2, PointType);
itkGetMacro(ProjectionCenterOffset2, PointType);
itkSetMacro(ProjectionCenter, PointType); itkSetMacro(ProjectionCenter, PointType);
itkGetMacro(ProjectionCenter, PointType); itkGetMacro(ProjectionCenter, PointType);
@ -315,7 +352,12 @@ protected:
double double
m_ProjectionAngle1IEC, m_ProjectionAngle1IEC,
m_ProjectionAngle2IEC, m_ProjectionAngle2IEC,
m_SCD, m_ProjectionAngle1OffsetIEC,
m_ProjectionAngle2OffsetIEC,
m_SCD1,
m_SCD2,
m_SCD1Offset,
m_SCD2Offset,
m_IntensityThreshold; m_IntensityThreshold;
@ -337,7 +379,9 @@ protected:
PointType PointType
/* center of projection in an IEC reference at /* center of projection in an IEC reference at
* Patient Origin of fixed images. Positioning scanner */ * Patient Origin of fixed images. Positioning scanner */
m_ProjectionCenter; m_ProjectionCenter,
m_ProjectionCenterOffset1,
m_ProjectionCenterOffset2;
/** Default Constructor **/ /** Default Constructor **/

File diff suppressed because it is too large Load Diff

View File

@ -80,6 +80,7 @@ public:
/** Projection angles - Gantry angle IEC */ /** Projection angles - Gantry angle IEC */
void SetProjectionAngle1IEC(double); void SetProjectionAngle1IEC(double);
void SetProjectionAngle2IEC(double); void SetProjectionAngle2IEC(double);
void SetProjectionAngleOffsetIEC(double,double);
/** Get projection angles - Gantry angle LPS /** Get projection angles - Gantry angle LPS
* Only meaningful after a 3D Volume is loaded */ * Only meaningful after a 3D Volume is loaded */
double GetProjectionAngle1LPS(); double GetProjectionAngle1LPS();
@ -87,8 +88,15 @@ public:
/** Source to axis distance - SAD /** Source to axis distance - SAD
* Often called source to object (SOD), (0018,1111) */ * Often called source to object (SOD), (0018,1111) */
void SetSCD(double); void SetSCD(double,double);
double GetSCD(); void SetSCDOffset(double,double);
double GetSCD1();
double GetSCD2();
void SetCustom_ProjectionCenterOffsetFixedAxes_IEC(double,double,double,double,double,double);
void SetCustom_ProjectionCenterFixedAxes_IEC(double,double,double);
/** Intensity threshold used for image projection, /** Intensity threshold used for image projection,
* any voxel below threshold is ignored */ * any voxel below threshold is ignored */
@ -99,7 +107,7 @@ public:
void SetCustom_2Dsize(int,int,int,int); void SetCustom_2Dsize(int,int,int,int);
void SetCustom_ImportTransform(double, double, double, void SetCustom_ImportTransform(double, double, double,
double, double, double); double, double, double);
void SetCustom_ProjectionCenterFixedAxes_IEC(double,double,double);
/** Set transform parameters for 3D Volume */ /** Set transform parameters for 3D Volume */
void SetInitialTranslations(double, double, double); void SetInitialTranslations(double, double, double);
@ -190,22 +198,6 @@ private:
using ITKtoVTKFilterType = itk::ImageToVTKImageFilter<OutputImageType>; using ITKtoVTKFilterType = itk::ImageToVTKImageFilter<OutputImageType>;
ImageType3D::PointType
CalculateDRTOrigin(
ImageType3D::SizeType m_ImageSize,
ImageType3D::SpacingType m_ImageResolution,
double dSCD
);
ImageType3D::PointType
CalculateProjectionCenterLPS(
ImageType3D::PointType m_ImportOffset,
ImageType3D::DirectionType m_VolumeLPS2IEC,
ImageType3D::PointType m_VolumeCOVLPS,
ImageType3D::PointType m_VolumeOriginLPS,
ImageType3D::PointType m_ProjectionCenter,
bool bZero);
TransformType::Pointer TransformType::Pointer
CalculateInternalTransform( CalculateInternalTransform(
ImageType3D::PointType m_TranslationOffset, ImageType3D::PointType m_TranslationOffset,
@ -220,7 +212,8 @@ private:
TransformType::Pointer TransformType::Pointer
transform; transform1,
transform2;
InterpolatorType::Pointer InterpolatorType::Pointer
interpolator1, interpolator1,
@ -287,7 +280,8 @@ private:
ImageType3D::PointType rtCouchOffset, ImageType3D::PointType rtCouchOffset,
InternalImageType::DirectionType VolumeLPStoIEC, InternalImageType::DirectionType VolumeLPStoIEC,
ImageType3D::PointType rtIsocenterLPS, ImageType3D::PointType rtIsocenterLPS,
ImageType3D::PointType IEC2DCMMapT); ImageType3D::PointType IEC2DCMMapT,
ImageType3D::PointType IEC2DCMMapR);
// The ResampleImageFilter is the driving force for the projection image generation. // The ResampleImageFilter is the driving force for the projection image generation.
@ -299,9 +293,6 @@ private:
filter1, filter1,
filter2; filter2;
//double TZero[3], RZero[3];
InternalImageType::DirectionType InternalImageType::DirectionType
Std_DRT2LPS; Std_DRT2LPS;