Implemented unload in imageProcessor. Fixed quite big bug on reloading of patient that kept trasformation matrix of previous alignment

This commit is contained in:
Proton local user
2023-03-22 18:40:48 +01:00
parent a8c25121d4
commit abc594dac3
2 changed files with 88 additions and 16 deletions

View File

@ -115,14 +115,11 @@ itkImageProcessor::itkImageProcessor()
m_RTMetaInfo = NULL;
m_DRTGeometryMetaInfo = NULL;
m_TransformMetaInfo = NULL;
m_TransformMetaInfo = TransformMetaInformation::New();
/* Initialise the projection geoemtry with defaults */
m_DRTGeometryMetaInfo = NULL;
m_DRTGeometryMetaInfo
= DRTProjectionGeometryImageMetaInformation::New();
m_DRTGeometryMetaInfo->SetSCD1(570.);
@ -396,6 +393,27 @@ void itkImageProcessor::SetCustom_UpdateMetaInfo(){
this->UpdateProjectionGeometryMeta();
}
int itkImageProcessor::unload3DVolumeAndMeta(){
std::cout << "*" << __COMPACT_PRETTY_FUNCTION__ << std::endl;
if (m_VolumeSourceDupli) {
m_VolumeSourceDupli = NULL;
m_VolumeSourceDupli = DuplicatorType::New();
}
m_CTMetaInfo = NULL;
m_DRTImage1MetaInfo = NULL;
m_DRTImage2MetaInfo = NULL;
m_TransformMetaInfo = NULL;
m_TransformMetaInfo = TransformMetaInformation::New();
return 1;
}
int itkImageProcessor::load3DSerieFromFiles( std::vector<std::string> v_fnames){
tPatOrientation m_PatOrientation
@ -477,10 +495,14 @@ int itkImageProcessor::load3DSerieFromFiles( std::vector<std::string> v_fnames){
caster3D->SetInput(imageSeriesReader3D->GetOutput());
caster3D->Update();
if (m_VolumeSourceDupli) {
m_VolumeSourceDupli = NULL;
m_VolumeSourceDupli = DuplicatorType::New();
}
if (m_VolumeSourceDupli == NULL)
std::cout << "NEVER HERE m_VolumeSourceDupli" << std::endl;
// if (m_VolumeSourceDupli) {
// std::cout << "NEVER HERE m_VolumeSourceDupli" << std::endl;
// m_VolumeSourceDupli = NULL;
// m_VolumeSourceDupli = DuplicatorType::New();
// }
m_VolumeSourceDupli->SetInputImage(caster3D->GetOutput());
m_VolumeSourceDupli->Update();
@ -644,23 +666,23 @@ int itkImageProcessor::fill3DVolumeMeta(
if(m_CTMetaInfo != NULL){
std::cout << "NEVER HERE m_CTMetaInfo" << std::endl;
m_CTMetaInfo = NULL;
// TODO UNLOAD
}
if(m_DRTImage1MetaInfo != NULL){
std::cout << "NEVER HERE m_DRTImage1MetaInfo" << std::endl;
m_DRTImage1MetaInfo = NULL;
// TODO UNLOAD
}
if(m_DRTImage2MetaInfo != NULL){
m_DRTImage2MetaInfo = NULL;
// TODO UNLOAD
std::cout << "NEVER HERE m_DRTImage2MetaInfo" << std::endl;
m_DRTImage2MetaInfo = NULL;
}
if(m_RTMetaInfo != NULL){
m_RTMetaInfo = NULL;
// TODO UNLOAD
std::cout << "NEVER HERE m_RTMetaInfo" << std::endl;
m_RTMetaInfo = NULL;
}
@ -889,6 +911,38 @@ double itkImageProcessor::GetProjectionAngle2LPS(){
m_DRTImage2MetaInfo->GetProjectionAngleLPS();
}
int itkImageProcessor::unload2DAndMeta(int iImgType){
switch (iImgType) {
case eProjectionOrientationType::PA:
std::cout << "*" << __COMPACT_PRETTY_FUNCTION__ << " PA "<< std::endl;
m_TImage1MetaInfo = NULL;
if (m_PASourceDupli) {
m_PASourceDupli = NULL;
m_PASourceDupli = DuplicatorType::New();
}
break;
case eProjectionOrientationType::LAT:
std::cout << "*" << __COMPACT_PRETTY_FUNCTION__ << " LAT "<< std::endl;
m_TImage2MetaInfo = NULL;
if (m_LATSourceDupli) {
m_LATSourceDupli = NULL;
m_LATSourceDupli = DuplicatorType::New();
}
break;
}
return 1;
}
int itkImageProcessor::load2D(const char * pcFName){
/* Check if we can open the file */
@ -1119,6 +1173,7 @@ int itkImageProcessor::load2D(const char * pcFName){
}
int itkImageProcessor::query2DimageReconstructionDiameter(const char *pcFName){
/* Check if we can open the file */
@ -1725,8 +1780,6 @@ int itkImageProcessor::StartRegistration(std::string extraInfo)
void itkImageProcessor::InitializeProjector()
{
if(m_DRTImage1MetaInfo == NULL ||
m_DRTImage2MetaInfo == NULL ||
m_DRTGeometryMetaInfo == NULL ||
@ -1995,19 +2048,31 @@ itkImageProcessor::CalcDRTImageDirections(
}
int itkImageProcessor::unloadRTPlanAndMeta(){
std::cout << "*" << __COMPACT_PRETTY_FUNCTION__ << std::endl;
m_RTMetaInfo = NULL;
return 1;
}
void itkImageProcessor::loadRTPlanInfo(
double dIsoX, double dIsoY, double dIsoZ,
double dLAT, double dVRT ,double dLNG){
if(m_RTMetaInfo != NULL){
std::cout << " NEVER HERE loadRTPlanInfo m_RTMetaInfo" << std::endl;
//TODO
}
if(m_CTMetaInfo != NULL){
std::cout << " ALWAYS HERE loadRTPlanInfo m_CTMetaInfo" << std::endl;
//TODO
}
if(m_DRTGeometryMetaInfo != NULL){
std::cout << " ALWAYS HERE loadRTPlanInfo m_DRTGeometryMetaInfo" << std::endl;
//TODO
}
@ -2037,6 +2102,7 @@ void itkImageProcessor::loadRTPlanInfo(
)
);
// std::cout<< "m_CTMetaInfo->GetImportOffset() "
// <<m_CTMetaInfo->GetImportOffset() <<std::endl;
@ -2557,6 +2623,9 @@ itkImageProcessor::CalcImportVolumeOffset(
ImageType3D::PointType Offset =
rtIsocenterLPS - IsoSupport_LPSPos;
std::cout << "*" << __COMPACT_PRETTY_FUNCTION__ <<
" " << Offset << std::endl;
return
Offset;

View File

@ -80,11 +80,14 @@ public:
/** Input data load methods*/
int load3DSerieFromFolder(const char* );
int load3DSerieFromFiles( std::vector<std::string> );
int unload3DVolumeAndMeta();
int load2D(const char *);
int unload2DAndMeta(int);
int query2DimageReconstructionDiameter(const char*);
void loadRTPlanInfo(double, double, double, double, double ,double);
int unloadRTPlanAndMeta();
/** Projection angles - Gantry angle IEC */
void SetProjectionAngle1IEC(double);