Fixed crashed when unloading Scout and fixed unloading of RTPlan

This commit is contained in:
viar
2022-09-13 17:04:13 +02:00
parent 9fc9290838
commit edf28c6a57
2 changed files with 106 additions and 109 deletions

View File

@ -36,7 +36,7 @@ void
TopogramImageMetaInformation
::PrintSelf(std::ostream& os, itk::Indent indent) const
{
Superclass::PrintSelf(os, indent);
Superclass::PrintSelf(os, indent);
}
@ -53,21 +53,21 @@ SetPatientOrientation(tPatOrientation m_orient)
this->m_PatientOrientation = m_orient;
for(int iIdx = 0 ; iIdx < 3; iIdx++){
for(int jIdx = 0 ; jIdx < 3; jIdx++){
for(int jIdx = 0 ; jIdx < 3; jIdx++){
switch (this->m_PatientOrientation) {
case tPatOrientation::HFS:
m_LPS2IECDirections.GetVnlMatrix()[iIdx][jIdx] = HFS2IEC[jIdx+iIdx*3];
break;
case tPatOrientation ::FFS:
m_LPS2IECDirections.GetVnlMatrix()[iIdx][jIdx] = FFS2IEC[jIdx+iIdx*3];
break;
default:
m_LPS2IECDirections.SetIdentity();
break;
}
switch (this->m_PatientOrientation) {
case tPatOrientation::HFS:
m_LPS2IECDirections.GetVnlMatrix()[iIdx][jIdx] = HFS2IEC[jIdx+iIdx*3];
break;
case tPatOrientation ::FFS:
m_LPS2IECDirections.GetVnlMatrix()[iIdx][jIdx] = FFS2IEC[jIdx+iIdx*3];
break;
default:
m_LPS2IECDirections.SetIdentity();
break;
}
}
}
}
@ -100,7 +100,7 @@ void
DRTImageMetaInformation
::PrintSelf(std::ostream& os, itk::Indent indent) const
{
Superclass::PrintSelf(os, indent);
Superclass::PrintSelf(os, indent);
}
@ -182,24 +182,20 @@ void DRTImageMetaInformation::SetSizeWithBounds(
dPixMaxOverlap =dNPixMin1;
if(dPixMaxOverlap > dNPixMax1){
dPixMaxOverlap = dNPixMax1;
}
dPixMaxOverlap = dNPixMax1;
}
if(floor(dPixMaxOverlap*2) > MaxSize[1]) {
m_Size[1] = MaxSize[1];
} else {
m_Size[1] = floor(dPixMaxOverlap*2);
}
m_Size[1] = MaxSize[1];
} else {
m_Size[1] = floor(dPixMaxOverlap*2);
}
m_Size[2] = 1;
m_Spacing = Spacing;
return;
return;
}
@ -263,9 +259,9 @@ CTVolumeImageMetaInformation::GetProjectionOriginLPS(
PointType ProjectionCenter)
{
// PointType Origin;
// Origin = this->m_OriginLPS;
// Origin = Origin - this->m_ImportOffset;
// PointType Origin;
// Origin = this->m_OriginLPS;
// Origin = Origin - this->m_ImportOffset;
DirectionType IECtoLPS_Directions;
IECtoLPS_Directions = this->m_LPS2IECDirections.GetTranspose();
@ -279,8 +275,8 @@ CTVolumeImageMetaInformation::GetProjectionOriginLPS(
* middle of the volume */
m_ProjectionOriginLPS[2] = this->GetCOV()[2] - this->m_ImportOffset[2];
return
m_ProjectionOriginLPS;
return
m_ProjectionOriginLPS;
}
@ -305,8 +301,8 @@ CTVolumeImageMetaInformation::GetProjectionOriginLPSZero(
m_ProjectionOriginLPS[2] = this->GetCOV()[2] - this->m_ImportOffset[2];
return
m_ProjectionOriginLPS - Origin;
return
m_ProjectionOriginLPS - Origin;
}
@ -315,29 +311,29 @@ 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 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);
PointType LastVoxelPosition =
(m_ImageDirections * Dest);
LastVoxelPosition [0] += m_OriginLPS[0];
LastVoxelPosition [1] += m_OriginLPS[1];
LastVoxelPosition [2] += m_OriginLPS[2];
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] );
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;
return
vBounds;
}
@ -365,7 +361,7 @@ void
CTVolumeImageMetaInformation
::PrintSelf(std::ostream& os, itk::Indent indent) const
{
Superclass::PrintSelf(os, indent);
Superclass::PrintSelf(os, indent);
}
@ -381,21 +377,21 @@ SetPatientOrientation(tPatOrientation m_orient)
this->m_PatientOrientation = m_orient;
for(int iIdx = 0 ; iIdx < 3; iIdx++){
for(int jIdx = 0 ; jIdx < 3; jIdx++){
for(int jIdx = 0 ; jIdx < 3; jIdx++){
switch (this->m_PatientOrientation) {
case tPatOrientation::HFS:
m_LPS2IECDirections.GetVnlMatrix()[iIdx][jIdx] = HFS2IEC[jIdx+iIdx*3];
break;
case tPatOrientation ::FFS:
m_LPS2IECDirections.GetVnlMatrix()[iIdx][jIdx] = FFS2IEC[jIdx+iIdx*3];
break;
default:
m_LPS2IECDirections.SetIdentity();
break;
}
switch (this->m_PatientOrientation) {
case tPatOrientation::HFS:
m_LPS2IECDirections.GetVnlMatrix()[iIdx][jIdx] = HFS2IEC[jIdx+iIdx*3];
break;
case tPatOrientation ::FFS:
m_LPS2IECDirections.GetVnlMatrix()[iIdx][jIdx] = FFS2IEC[jIdx+iIdx*3];
break;
default:
m_LPS2IECDirections.SetIdentity();
break;
}
}
}
}
@ -478,7 +474,7 @@ void
DRTProjectionGeometryImageMetaInformation
::PrintSelf(std::ostream& os, itk::Indent indent) const
{
Superclass::PrintSelf(os, indent);
Superclass::PrintSelf(os, indent);
}
@ -505,7 +501,7 @@ void
RTGeometryMetaInformation
::PrintSelf(std::ostream& os, itk::Indent indent) const
{
Superclass::PrintSelf(os, indent);
Superclass::PrintSelf(os, indent);
}
@ -521,17 +517,17 @@ RTGeometryMetaInformation
TransformMetaInformation ::
TransformMetaInformation (){
m_Translations.Fill(0.);
m_Translations.Fill(0.);
m_Rotations.Fill(0.);
m_Rotations.Fill(0.);
m_UserRotations.Fill(0.);
m_UserRotations.Fill(0.);
m_UserTranslations.Fill(0.);
m_UserTranslations.Fill(0.);
m_ReferenceTransform.Fill(0.);
m_ReferenceTransform.Fill(0.);
m_CurrentTransform.Fill(0.);
m_CurrentTransform.Fill(0.);
}
@ -539,7 +535,7 @@ void
TransformMetaInformation
::PrintSelf(std::ostream& os, itk::Indent indent) const
{
Superclass::PrintSelf(os, indent);
Superclass::PrintSelf(os, indent);
}

View File

@ -1692,16 +1692,17 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
// This is based on the calibrated iso to be sure...
std::vector <double> vBounds = m_CTMetaInfo->CalculateRegions(
NominalIsocenter_wZcorrectionLPS//m_DRTImage1MetaInfo->GetProjectionOriginLPS()
NominalIsocenter_wZcorrectionLPS
// m_DRTImage1MetaInfo->GetProjectionOriginLPS()
);
// std::cout<<"Bounds1: "
// <<vBounds.data()[0]<<" "
// <<vBounds.data()[1]<<" "
// <<vBounds.data()[2]<<" "
// <<vBounds.data()[3]<<" "
// <<vBounds.data()[4]<<" "
// <<vBounds.data()[5]<<std::endl;
std::cout<<"Bounds1: "
<<vBounds.data()[0]<<" "
<<vBounds.data()[1]<<" "
<<vBounds.data()[2]<<" "
<<vBounds.data()[3]<<" "
<<vBounds.data()[4]<<" "
<<vBounds.data()[5]<<std::endl;
m_DRTImage1MetaInfo->SetSizeWithBounds(
vBounds.data(),
@ -1735,16 +1736,16 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
Std_DRT2LPS)
);
// std::cout<<"IsocenterOffsetLPS"<< IsocenterOffsetLPS <<std::endl;
// std::cout<<"CalibratedIsocenterLPS"<< CalibratedIsocenterLPS <<std::endl;
// std::cout<<"CalibratedIsocenterZeroLPS"<< CalibratedIsocenterZeroLPS <<std::endl;
// std::cout<<"m_DRTImage1MetaInfo->GetSize()"<< m_DRTImage1MetaInfo->GetSize() <<std::endl;
// std::cout<<"m_DRTImage1MetaInfo->GetSpacing()"<< m_DRTImage1MetaInfo->GetSpacing() <<std::endl;
// std::cout<<"m_DRTImage1MetaInfo->GetOrigin()"<< m_DRTImage1MetaInfo->GetOrigin() <<std::endl;
// std::cout<<"m_DRTImage1MetaInfo->GetCOV()"<< m_DRTImage1MetaInfo->GetCOV() <<std::endl;
// std::cout<<"m_DRTImage1MetaInfo->GetOriginLPS()"<< m_DRTImage1MetaInfo->GetOriginLPS() <<std::endl;
// std::cout<<"m_DRTImage1MetaInfo->GetProjectionAngleLPS()"<<m_DRTImage1MetaInfo->GetProjectionAngleLPS()<<std::endl;
// std::cout<<"m_DRTImage1MetaInfo->GetImageDirectionsLPS()"<< m_DRTImage1MetaInfo->GetImageDirectionsLPS() <<std::endl;
std::cout<<"IsocenterOffsetLPS"<< IsocenterOffsetLPS <<std::endl;
std::cout<<"CalibratedIsocenterLPS"<< CalibratedIsocenterLPS <<std::endl;
std::cout<<"CalibratedIsocenterZeroLPS"<< CalibratedIsocenterZeroLPS <<std::endl;
std::cout<<"m_DRTImage1MetaInfo->GetSize()"<< m_DRTImage1MetaInfo->GetSize() <<std::endl;
std::cout<<"m_DRTImage1MetaInfo->GetSpacing()"<< m_DRTImage1MetaInfo->GetSpacing() <<std::endl;
std::cout<<"m_DRTImage1MetaInfo->GetOrigin()"<< m_DRTImage1MetaInfo->GetOrigin() <<std::endl;
std::cout<<"m_DRTImage1MetaInfo->GetCOV()"<< m_DRTImage1MetaInfo->GetCOV() <<std::endl;
std::cout<<"m_DRTImage1MetaInfo->GetOriginLPS()"<< m_DRTImage1MetaInfo->GetOriginLPS() <<std::endl;
std::cout<<"m_DRTImage1MetaInfo->GetProjectionAngleLPS()"<<m_DRTImage1MetaInfo->GetProjectionAngleLPS()<<std::endl;
std::cout<<"m_DRTImage1MetaInfo->GetImageDirectionsLPS()"<< m_DRTImage1MetaInfo->GetImageDirectionsLPS() <<std::endl;
// SECOND
@ -1787,13 +1788,13 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
NominalIsocenter_wZcorrectionLPS//m_DRTImage2MetaInfo->GetProjectionOriginLPS()
);
// std::cout<<"Bounds2: "
// <<vBounds.data()[0]<<" "
// <<vBounds.data()[1]<<" "
// <<vBounds.data()[2]<<" "
// <<vBounds.data()[3]<<" "
// <<vBounds.data()[4]<<" "
// <<vBounds.data()[5]<<std::endl;
std::cout<<"Bounds2: "
<<vBounds.data()[0]<<" "
<<vBounds.data()[1]<<" "
<<vBounds.data()[2]<<" "
<<vBounds.data()[3]<<" "
<<vBounds.data()[4]<<" "
<<vBounds.data()[5]<<std::endl;
m_DRTImage2MetaInfo->SetSizeWithBounds(
vBounds.data(),
@ -1823,16 +1824,16 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
Std_DRT2LPS)
);
// std::cout<<"IsocenterOffsetLPS"<< IsocenterOffsetLPS <<std::endl;
// std::cout<<"CalibratedIsocenterLPS"<< CalibratedIsocenterLPS <<std::endl;
// std::cout<<"CalibratedIsocenterZeroLPS"<< CalibratedIsocenterZeroLPS <<std::endl;
// std::cout<<"m_DRTImage2MetaInfo->GetSize()"<< m_DRTImage2MetaInfo->GetSize() <<std::endl;
// std::cout<<"m_DRTImage2MetaInfo->GetSpacing()"<< m_DRTImage2MetaInfo->GetSpacing() <<std::endl;
// std::cout<<"m_DRTImage2MetaInfo->GetOrigin()"<< m_DRTImage2MetaInfo->GetOrigin() <<std::endl;
// std::cout<<"m_DRTImage2MetaInfo->GetCOV()"<< m_DRTImage2MetaInfo->GetCOV() <<std::endl;
// std::cout<<"m_DRTImage2MetaInfo->GetOriginLPS()"<< m_DRTImage2MetaInfo->GetOriginLPS() <<std::endl;
// std::cout<<"m_DRTImage2MetaInfo->GetProjectionAngleLPS()"<<m_DRTImage2MetaInfo->GetProjectionAngleLPS()<<std::endl;
// std::cout<<"m_DRTImage2MetaInfo->GetImageDirectionsLPS()"<< m_DRTImage2MetaInfo->GetImageDirectionsLPS() <<std::endl;
std::cout<<"IsocenterOffsetLPS"<< IsocenterOffsetLPS <<std::endl;
std::cout<<"CalibratedIsocenterLPS"<< CalibratedIsocenterLPS <<std::endl;
std::cout<<"CalibratedIsocenterZeroLPS"<< CalibratedIsocenterZeroLPS <<std::endl;
std::cout<<"m_DRTImage2MetaInfo->GetSize()"<< m_DRTImage2MetaInfo->GetSize() <<std::endl;
std::cout<<"m_DRTImage2MetaInfo->GetSpacing()"<< m_DRTImage2MetaInfo->GetSpacing() <<std::endl;
std::cout<<"m_DRTImage2MetaInfo->GetOrigin()"<< m_DRTImage2MetaInfo->GetOrigin() <<std::endl;
std::cout<<"m_DRTImage2MetaInfo->GetCOV()"<< m_DRTImage2MetaInfo->GetCOV() <<std::endl;
std::cout<<"m_DRTImage2MetaInfo->GetOriginLPS()"<< m_DRTImage2MetaInfo->GetOriginLPS() <<std::endl;
std::cout<<"m_DRTImage2MetaInfo->GetProjectionAngleLPS()"<<m_DRTImage2MetaInfo->GetProjectionAngleLPS()<<std::endl;
std::cout<<"m_DRTImage2MetaInfo->GetImageDirectionsLPS()"<< m_DRTImage2MetaInfo->GetImageDirectionsLPS() <<std::endl;