A bit of code comments cleanup

This commit is contained in:
Giovanni Fattori
2025-05-14 23:20:02 +02:00
parent 06ad957615
commit 2361354982
11 changed files with 9 additions and 521 deletions

View File

@ -11,6 +11,7 @@ static double FFS2IEC[9] = {
0, 0, -1, 0, 0, -1,
0, -1, 0}; 0, -1, 0};
namespace itk namespace itk
{ {
@ -31,7 +32,6 @@ TopogramImageMetaInformation(){
} }
void void
TopogramImageMetaInformation TopogramImageMetaInformation
::PrintSelf(std::ostream& os, itk::Indent indent) const ::PrintSelf(std::ostream& os, itk::Indent indent) const
@ -39,14 +39,12 @@ TopogramImageMetaInformation
Superclass::PrintSelf(os, indent); Superclass::PrintSelf(os, indent);
} }
TopogramImageMetaInformation TopogramImageMetaInformation
::~TopogramImageMetaInformation () ::~TopogramImageMetaInformation ()
{ {
} }
void TopogramImageMetaInformation :: void TopogramImageMetaInformation ::
SetPatientOrientation(tPatOrientation m_orient) SetPatientOrientation(tPatOrientation m_orient)
{ {
@ -71,7 +69,6 @@ SetPatientOrientation(tPatOrientation m_orient)
} }
DRTImageMetaInformation:: DRTImageMetaInformation::
DRTImageMetaInformation(){ DRTImageMetaInformation(){
@ -112,7 +109,6 @@ DRTImageMetaInformation
} }
DRTImageMetaInformation::PointType DRTImageMetaInformation::PointType
DRTImageMetaInformation::GetOrigin() DRTImageMetaInformation::GetOrigin()
{ {
@ -132,67 +128,12 @@ DRTImageMetaInformation::GetOrigin()
Origin; Origin;
} }
void DRTImageMetaInformation::SetSizeWithBounds( void DRTImageMetaInformation::SetSizeWithBounds(
double* dBounds, double* dBounds,
SizeType MaxSize, SizeType MaxSize,
SpacingType Spacing) 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[0] = MaxSize[0]; m_Size[0] = MaxSize[0];
m_Size[1] = MaxSize[1]; m_Size[1] = MaxSize[1];
m_Size[2] = 1; m_Size[2] = 1;
@ -202,7 +143,6 @@ void DRTImageMetaInformation::SetSizeWithBounds(
return; return;
} }
DRTImageMetaInformation::PointType DRTImageMetaInformation::PointType
DRTImageMetaInformation::GetLPStoProjectionGeoLPSOffset() DRTImageMetaInformation::GetLPStoProjectionGeoLPSOffset()
{ {
@ -263,10 +203,6 @@ CTVolumeImageMetaInformation::GetProjectionOriginLPS(
PointType ProjectionCenter) PointType ProjectionCenter)
{ {
// PointType Origin;
// Origin = this->m_OriginLPS;
// Origin = Origin - this->m_ImportOffset;
DirectionType IECtoLPS_Directions; DirectionType IECtoLPS_Directions;
IECtoLPS_Directions = this->m_LPS2IECDirections.GetTranspose(); IECtoLPS_Directions = this->m_LPS2IECDirections.GetTranspose();
@ -360,7 +296,6 @@ CTVolumeImageMetaInformation(){
this->m_ImportOffset.Fill(0.); this->m_ImportOffset.Fill(0.);
} }
void void
CTVolumeImageMetaInformation CTVolumeImageMetaInformation
::PrintSelf(std::ostream& os, itk::Indent indent) const ::PrintSelf(std::ostream& os, itk::Indent indent) const
@ -368,7 +303,6 @@ CTVolumeImageMetaInformation
Superclass::PrintSelf(os, indent); Superclass::PrintSelf(os, indent);
} }
CTVolumeImageMetaInformation CTVolumeImageMetaInformation
::~CTVolumeImageMetaInformation () ::~CTVolumeImageMetaInformation ()
{ {
@ -432,7 +366,6 @@ CTVolumeImageMetaInformation::GetOriginWOffset(){
this->m_OriginLPS - this->m_ImportOffset; this->m_OriginLPS - this->m_ImportOffset;
} }
DRTProjectionGeometryImageMetaInformation:: DRTProjectionGeometryImageMetaInformation::
DRTProjectionGeometryImageMetaInformation(){ DRTProjectionGeometryImageMetaInformation(){
@ -487,16 +420,12 @@ DRTProjectionGeometryImageMetaInformation
Superclass::PrintSelf(os, indent); Superclass::PrintSelf(os, indent);
} }
DRTProjectionGeometryImageMetaInformation DRTProjectionGeometryImageMetaInformation
::~DRTProjectionGeometryImageMetaInformation () ::~DRTProjectionGeometryImageMetaInformation ()
{ {
} }
RTGeometryMetaInformation:: RTGeometryMetaInformation::
RTGeometryMetaInformation(){ RTGeometryMetaInformation(){
@ -514,7 +443,6 @@ RTGeometryMetaInformation
Superclass::PrintSelf(os, indent); Superclass::PrintSelf(os, indent);
} }
RTGeometryMetaInformation RTGeometryMetaInformation
::~RTGeometryMetaInformation() ::~RTGeometryMetaInformation()
{ {
@ -544,7 +472,6 @@ InternalTransformMetaInformation
} }
R23MetaInformation:: R23MetaInformation::
R23MetaInformation (){ R23MetaInformation (){
@ -553,7 +480,6 @@ R23MetaInformation (){
m_MetricType = tMetricTypeEnum::NCC; m_MetricType = tMetricTypeEnum::NCC;
} }
void void
R23MetaInformation R23MetaInformation
::PrintSelf(std::ostream& os, itk::Indent indent) const ::PrintSelf(std::ostream& os, itk::Indent indent) const
@ -561,7 +487,6 @@ R23MetaInformation
Superclass::PrintSelf(os, indent); Superclass::PrintSelf(os, indent);
} }
R23MetaInformation R23MetaInformation
::~R23MetaInformation () ::~R23MetaInformation ()
{ {
@ -632,11 +557,4 @@ TransformMetaInformation
} }
} }

View File

@ -24,7 +24,6 @@ typedef enum eImageOrientationType{
FFS = 2 FFS = 2
} tPatOrientation; } tPatOrientation;
typedef enum eHandlingRotImpTransform { typedef enum eHandlingRotImpTransform {
ALWAYS_USE = 0, ALWAYS_USE = 0,
NEVER_USE =1, NEVER_USE =1,
@ -42,7 +41,6 @@ typedef enum eDegreeOfFreedomType {
OTHER =7 OTHER =7
} tDegreeOfFreedomEnum; } tDegreeOfFreedomEnum;
typedef enum eOptimizerType{ typedef enum eOptimizerType{
POWELL = 0, POWELL = 0,
AMOEBA = 1, AMOEBA = 1,
@ -54,7 +52,6 @@ typedef enum eMetricType{
MI = 1 MI = 1
} tMetricTypeEnum; } tMetricTypeEnum;
inline int GetNumberOfDOF(eDegreeOfFreedomType dof) inline int GetNumberOfDOF(eDegreeOfFreedomType dof)
{ {
switch (dof) { switch (dof) {
@ -76,7 +73,6 @@ inline int GetNumberOfDOF(eDegreeOfFreedomType dof)
return 0; return 0;
}; };
class DegreeOfFreedom : public itk::Object { class DegreeOfFreedom : public itk::Object {
public: public:
@ -134,7 +130,6 @@ public:
protected: protected:
tPatOrientation tPatOrientation
m_PatientOrientation; m_PatientOrientation;
@ -149,7 +144,6 @@ protected:
DirectionType DirectionType
m_LPS2IECDirections; m_LPS2IECDirections;
/** Default Constructor **/ /** Default Constructor **/
TopogramImageMetaInformation (); TopogramImageMetaInformation ();
/** Default Destructor **/ /** Default Destructor **/
@ -193,9 +187,6 @@ public:
itkSetMacro(Spacing,SpacingType); itkSetMacro(Spacing,SpacingType);
itkGetMacro(Spacing,SpacingType); itkGetMacro(Spacing,SpacingType);
//itkSetMacro(Origin,PointType);
//itkGetMacro(Origin,PointType);
itkSetMacro(OriginLPS,PointType); itkSetMacro(OriginLPS,PointType);
itkGetMacro(OriginLPS,PointType); itkGetMacro(OriginLPS,PointType);
@ -645,9 +636,6 @@ public:
itkSetEnumMacro(MetricType, tMetricTypeEnum); itkSetEnumMacro(MetricType, tMetricTypeEnum);
itkGetEnumMacro(MetricType, tMetricTypeEnum); itkGetEnumMacro(MetricType, tMetricTypeEnum);
protected: protected:
tDegreeOfFreedomEnum tDegreeOfFreedomEnum
@ -693,7 +681,6 @@ public:
/** object information streaming **/ /** object information streaming **/
void PrintSelf(std::ostream& os, itk::Indent indent) const; void PrintSelf(std::ostream& os, itk::Indent indent) const;
itkSetMacro(HiddenTranslations,PointType); itkSetMacro(HiddenTranslations,PointType);
itkGetMacro(HiddenTranslations,PointType); itkGetMacro(HiddenTranslations,PointType);

View File

@ -119,7 +119,7 @@ itkImageProcessor::itkImageProcessor()
Point3D[1]=0.; Point3D[1]=0.;
Point3D[2]=175.; Point3D[2]=175.;
m_DRTGeometryMetaInfo->SetProjectionCenter(Point3D); m_DRTGeometryMetaInfo->SetProjectionCenter(Point3D);
// m_DRTGeometryMetaInfo->SetProjectionCenter(Point3D);
ImageType3D::SizeType ImageType3D::SizeType
ImageSize; ImageSize;
ImageSize[0]=512; ImageSize[0]=512;
@ -164,7 +164,6 @@ void itkImageProcessor::SetNumberOfWorkingUnits(int iN){
} }
} }
const CTVolumeImageMetaInformation::Pointer const CTVolumeImageMetaInformation::Pointer
itkImageProcessor::GetCTMetaInfo( itkImageProcessor::GetCTMetaInfo(
){ ){
@ -188,7 +187,6 @@ itkImageProcessor::GetDRTGeoMetaInfo(){
} }
void itkImageProcessor::PrintSelf(std::ostream& os, Indent indent) const void itkImageProcessor::PrintSelf(std::ostream& os, Indent indent) const
{ {
Superclass::PrintSelf(os, indent); Superclass::PrintSelf(os, indent);
@ -221,7 +219,6 @@ double itkImageProcessor::GetSCD2(){
m_DRTImage2MetaInfo ->GetSCD(); m_DRTImage2MetaInfo ->GetSCD();
} }
double itkImageProcessor::GetPanelOffsetPGeo(tProjOrientationType ImgPrj){ double itkImageProcessor::GetPanelOffsetPGeo(tProjOrientationType ImgPrj){
if(m_CTMetaInfo == NULL || if(m_CTMetaInfo == NULL ||
@ -269,8 +266,6 @@ double itkImageProcessor::GetPanelOffset2(){
m_DRTGeometryMetaInfo ->GetPanel2Offset(); m_DRTGeometryMetaInfo ->GetPanel2Offset();
} }
tDegreeOfFreedomEnum tDegreeOfFreedomEnum
itkImageProcessor::GetDegreeOfFreedom() itkImageProcessor::GetDegreeOfFreedom()
{ {
@ -288,7 +283,6 @@ void itkImageProcessor::SetUseRotationsForImportOffset(bool bVal){
return; return;
} }
void itkImageProcessor::SetCustom_ImportTransform(double dTx, void itkImageProcessor::SetCustom_ImportTransform(double dTx,
double dTy, double dTy,
double dTz, double dTz,
@ -343,7 +337,6 @@ void itkImageProcessor::SetCustom_ProjectionCenterOffsetFixedAxes_IEC(
} }
void itkImageProcessor::SetCustom_ProjectionCenterFixedAxes_IEC( void itkImageProcessor::SetCustom_ProjectionCenterFixedAxes_IEC(
double dX1, double dX1,
double dY1, double dY1,
@ -378,7 +371,7 @@ void itkImageProcessor::SetCustom_2Dres(double nX1,double nY1,double nX2,double
Spacing [1] = nY2; Spacing [1] = nY2;
Spacing [2] = 1.; Spacing [2] = 1.;
m_DRTGeometryMetaInfo->SetDRT2Spacing(Spacing); m_DRTGeometryMetaInfo->SetDRT2Spacing(Spacing);
//TODO UPDATE TO FOLLOW
} }
void itkImageProcessor::SetCustom_2Dsize(int nX1, int nY1,int nX2,int nY2) void itkImageProcessor::SetCustom_2Dsize(int nX1, int nY1,int nX2,int nY2)
@ -399,7 +392,6 @@ void itkImageProcessor::SetCustom_2Dsize(int nX1, int nY1,int nX2,int nY2)
Size [2] = 1.; Size [2] = 1.;
m_DRTGeometryMetaInfo->SetDRT2Size(Size); m_DRTGeometryMetaInfo->SetDRT2Size(Size);
//TODO UPDATE TO FOLLOW
} }
void itkImageProcessor::SetCustom_UpdateMetaInfo(){ void itkImageProcessor::SetCustom_UpdateMetaInfo(){
@ -424,7 +416,6 @@ int itkImageProcessor::unload3DVolumeAndMeta(){
m_TransformMetaInfo = NULL; m_TransformMetaInfo = NULL;
m_TransformMetaInfo = TransformMetaInformation::New(); m_TransformMetaInfo = TransformMetaInformation::New();
this->ResetROIRegions(); this->ResetROIRegions();
return 1; return 1;
@ -436,8 +427,8 @@ int itkImageProcessor::load3DSerieFromFiles( std::vector<std::string> v_fnames){
tPatOrientation m_PatOrientation tPatOrientation m_PatOrientation
= tPatOrientation::NotDefined; = tPatOrientation::NotDefined;
/* Since are not sure DB indexer to sort images, /* Since are not sure what we get here,
* we run the IPP sorter here. */ * we run the IPP sorter. */
using IppSorterType = gdcm::IPPSorter; using IppSorterType = gdcm::IPPSorter;
IppSorterType ZSorter; IppSorterType ZSorter;
@ -450,12 +441,6 @@ int itkImageProcessor::load3DSerieFromFiles( std::vector<std::string> v_fnames){
return EXIT_FAILURE; return EXIT_FAILURE;
} }
/* Some debugging output */
//std::cout << "Sorting succeeded:" << std::endl;
//ZSorter.Print( std::cout );
//std::cout << "Found z-spacing:" << std::endl;
//std::cout << ZSorter.GetZSpacing() << std::endl;
const std::vector<std::string> & v_sortedFnames = const std::vector<std::string> & v_sortedFnames =
ZSorter.GetFilenames(); ZSorter.GetFilenames();
@ -472,7 +457,6 @@ int itkImageProcessor::load3DSerieFromFiles( std::vector<std::string> v_fnames){
imageSeriesReader3D->SetFileNames(v_sortedFnames); imageSeriesReader3D->SetFileNames(v_sortedFnames);
imageSeriesReader3D->SetNumberOfWorkUnits(iNWUnits); imageSeriesReader3D->SetNumberOfWorkUnits(iNWUnits);
imageSeriesReader3D->ForceOrthogonalDirectionOff(); // properly read CTs with gantry tilt imageSeriesReader3D->ForceOrthogonalDirectionOff(); // properly read CTs with gantry tilt
//imageSeriesReader3D->SetSpacingWarningRelThreshold();
imageSeriesReader3D->Update(); imageSeriesReader3D->Update();
@ -505,8 +489,6 @@ int itkImageProcessor::load3DSerieFromFiles( std::vector<std::string> v_fnames){
return -1; return -1;
} }
////////////////////////*****************//////////////////////////
CastFilterType3D::Pointer caster3D = CastFilterType3D::Pointer caster3D =
CastFilterType3D::New(); CastFilterType3D::New();
@ -532,22 +514,13 @@ int itkImageProcessor::load3DSerieFromFiles( std::vector<std::string> v_fnames){
const typename ImageType3D::SizeType& inputSize = const typename ImageType3D::SizeType& inputSize =
inputRegion.GetSize(); inputRegion.GetSize();
// Inputs Info
// std::cout << "inputSpacing " << std::endl;
// std::cout << inputSpacing << std::endl;
// std::cout << "inputRegion " << std::endl;
// std::cout << inputRegion << std::endl;
// std::cout << "inputSize " << std::endl;
// std::cout << inputSize << std::endl;
ImageType3D::SpacingType outputSpacing; ImageType3D::SpacingType outputSpacing;
outputSpacing[0] = inputSpacing[0]; outputSpacing[0] = inputSpacing[0];
outputSpacing[1] = inputSpacing[1]; outputSpacing[1] = inputSpacing[1];
outputSpacing[2] = m_SamplingLNG; outputSpacing[2] = m_SamplingLNG;
ImageType3D::SizeType outputSize; ImageType3D::SizeType outputSize;
// typedef typename ImageType3D::SizeType::SizeValueType SizeValueType;
outputSize[0] = static_cast<SizeValueType>( outputSize[0] = static_cast<SizeValueType>(
inputSize[0] * inputSpacing[0] / outputSpacing[0] + .5); inputSize[0] * inputSpacing[0] / outputSpacing[0] + .5);
outputSize[1] = static_cast<SizeValueType>( outputSize[1] = static_cast<SizeValueType>(
@ -576,17 +549,9 @@ int itkImageProcessor::load3DSerieFromFiles( std::vector<std::string> v_fnames){
} }
////////////////////////*****************//////////////////////////
if (m_VolumeSourceDupli == NULL) if (m_VolumeSourceDupli == NULL)
std::cout << "NEVER HERE m_VolumeSourceDupli" << std::endl; 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->SetInputImage(caster3D->GetOutput());
m_VolumeSourceDupli->Update(); m_VolumeSourceDupli->Update();
@ -633,7 +598,6 @@ int itkImageProcessor::fill3DVolumeMeta(
m_RTMetaInfo = NULL; m_RTMetaInfo = NULL;
} }
/* copy useful meta information into the CT container */ /* copy useful meta information into the CT container */
m_CTMetaInfo = CTVolumeImageMetaInformation::New(); m_CTMetaInfo = CTVolumeImageMetaInformation::New();
m_CTMetaInfo->SetPatientOrientation(m_PatOrientation); m_CTMetaInfo->SetPatientOrientation(m_PatOrientation);
@ -648,8 +612,6 @@ int itkImageProcessor::fill3DVolumeMeta(
PointOffset.Fill(0.); PointOffset.Fill(0.);
m_CTMetaInfo->SetImportOffset(PointOffset); m_CTMetaInfo->SetImportOffset(PointOffset);
/* initialise DRT meta */ /* initialise DRT meta */
m_DRTImage1MetaInfo = DRTImageMetaInformation::New(); m_DRTImage1MetaInfo = DRTImageMetaInformation::New();
m_DRTImage1MetaInfo->SetProjectionAngleLPS( m_DRTImage1MetaInfo->SetProjectionAngleLPS(
@ -664,7 +626,6 @@ int itkImageProcessor::fill3DVolumeMeta(
m_DRTGeometryMetaInfo->GetSCD1Offset() m_DRTGeometryMetaInfo->GetSCD1Offset()
); );
/* Calculate projection angle IEC to LPS */ /* Calculate projection angle IEC to LPS */
m_DRTImage2MetaInfo = DRTImageMetaInformation::New(); m_DRTImage2MetaInfo = DRTImageMetaInformation::New();
m_DRTImage2MetaInfo->SetProjectionAngleLPS( m_DRTImage2MetaInfo->SetProjectionAngleLPS(
@ -679,35 +640,12 @@ int itkImageProcessor::fill3DVolumeMeta(
m_DRTGeometryMetaInfo->GetSCD2Offset() m_DRTGeometryMetaInfo->GetSCD2Offset()
); );
// std::cout<< "///////////////// 3D VOLUME BEG ///////////////" <<std::endl;
// std::cout<< "OriginLPS"<< m_CTMetaInfo->GetOriginLPS() <<std::endl;
// std::cout<< "COV"<< m_CTMetaInfo->GetCOV() <<std::endl;
std::cout<< "ImportOffset"<< m_CTMetaInfo->GetImportOffset() <<std::endl; std::cout<< "ImportOffset"<< m_CTMetaInfo->GetImportOffset() <<std::endl;
// std::cout<< "LPS2IEC"<< m_CTMetaInfo->GetLPS2IECDirections() <<std::endl;
// std::cout<< "Size"<< m_CTMetaInfo->GetSize() <<std::endl;
// std::cout<< "Spacing"<< m_CTMetaInfo->GetSpacing() <<std::endl;
// std::cout<< "pAngleLPS1"<< m_DRTImage1MetaInfo->GetProjectionAngleLPS() <<std::endl;
// std::cout<< "SCD1"<< m_DRTImage1MetaInfo->GetSCD() <<std::endl;
// std::cout<< "pAngleLPS2"<< m_DRTImage2MetaInfo->GetProjectionAngleLPS() <<std::endl;
// std::cout<< "SCD2"<< m_DRTImage2MetaInfo->GetSCD() <<std::endl;
// std::cout<< "///////////////// 3D VOLUME END ///////////////" <<std::endl;
this->UpdateProjectionGeometryMeta(); this->UpdateProjectionGeometryMeta();
// 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.
// this is done internally in the dSiddonFilter.
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
const std::vector <double> itkImageProcessor::GetRTImportOffset() const std::vector <double> itkImageProcessor::GetRTImportOffset()
@ -777,15 +715,12 @@ itkImageProcessor::CalcProjectionAngleLPS(
tPatOrientation pOrient, tPatOrientation pOrient,
double pAngleIEC){ double pAngleIEC){
// std::cout<< "CalcProjectèionAngleLPS :: pAngleIEC " << pAngleIEC <<std::endl;
double dProj = pAngleIEC; double dProj = pAngleIEC;
InternalImageType::DirectionType InternalImageType::DirectionType
currIECtoLPS; currIECtoLPS;
/* NOTE that we transpose on the fly... */
/* NOTE WE TRANSPOSE ON THE FLY... */
switch (pOrient) { switch (pOrient) {
case tPatOrientation :: HFS: case tPatOrientation :: HFS:
for(int iIdx = 0 ; iIdx < 3; iIdx++){ for(int iIdx = 0 ; iIdx < 3; iIdx++){
@ -844,7 +779,6 @@ void itkImageProcessor::SetProjectionAngleOffsetIEC(double dOff1, double dOff2)
m_DRTGeometryMetaInfo->SetProjectionAngle2OffsetIEC(dOff2); m_DRTGeometryMetaInfo->SetProjectionAngle2OffsetIEC(dOff2);
} }
void itkImageProcessor::SetProjectionAngle1IEC(double dGantryAngle) void itkImageProcessor::SetProjectionAngle1IEC(double dGantryAngle)
{ {
m_DRTGeometryMetaInfo->SetProjectionAngle1IEC(dGantryAngle); m_DRTGeometryMetaInfo->SetProjectionAngle1IEC(dGantryAngle);
@ -952,8 +886,6 @@ int itkImageProcessor::load2D(const char * pcFName){
} }
tokens.clear(); tokens.clear();
// std::cout<<"Intensity window center and width: "<< dIntensityWindow[0] <<" "<< dIntensityWindow[1] <<std::endl;
/* Image orientation */ /* Image orientation */
eImageOrientationType eImageOrientationType
currImgOrient; currImgOrient;
@ -961,10 +893,8 @@ int itkImageProcessor::load2D(const char * pcFName){
*std::remove(sTmpString, sTmpString + strlen(sTmpString), ' ') = 0; *std::remove(sTmpString, sTmpString + strlen(sTmpString), ' ') = 0;
if(!strcmp(sTmpString,ImageOrientationStrings[eImageOrientationType::HFS])){ if(!strcmp(sTmpString,ImageOrientationStrings[eImageOrientationType::HFS])){
// std::cout<<"Image orientation: HFS"<<std::endl;
currImgOrient = eImageOrientationType::HFS; currImgOrient = eImageOrientationType::HFS;
} else if(!strcmp(sTmpString,ImageOrientationStrings[eImageOrientationType::FFS])){ } else if(!strcmp(sTmpString,ImageOrientationStrings[eImageOrientationType::FFS])){
// std::cout<<"Image orientation: FFS"<<std::endl;
currImgOrient = eImageOrientationType::FFS; currImgOrient = eImageOrientationType::FFS;
} else { } else {
std::cerr<< "Image Orientation: unrecognised"<< sTmpString <<std::endl; std::cerr<< "Image Orientation: unrecognised"<< sTmpString <<std::endl;
@ -996,9 +926,6 @@ int itkImageProcessor::load2D(const char * pcFName){
ImageDirectionType3D LocalizerImagDirectionDCM = ImageDirectionType3D LocalizerImagDirectionDCM =
imageReader2D->GetOutput()->GetDirection(); imageReader2D->GetOutput()->GetDirection();
// std::cout<<"LocalizerImagDirectionDCM " <<LocalizerImagDirectionDCM <<std::endl;
InternalImageType::DirectionType toIECDirection; InternalImageType::DirectionType toIECDirection;
for(int iIdx = 0 ; iIdx < 3; iIdx++){ for(int iIdx = 0 ; iIdx < 3; iIdx++){
for(int jIdx = 0 ; jIdx < 3; jIdx++){ for(int jIdx = 0 ; jIdx < 3; jIdx++){
@ -1015,17 +942,10 @@ int itkImageProcessor::load2D(const char * pcFName){
} }
} }
// std::cout<<"toIECDirection " <<toIECDirection <<std::endl;
/* calculate image orientation with respect to fixed IEC */ /* calculate image orientation with respect to fixed IEC */
InternalImageType::DirectionType LocalizerImagDirectionIEC = InternalImageType::DirectionType LocalizerImagDirectionIEC =
toIECDirection * LocalizerImagDirectionDCM; toIECDirection * LocalizerImagDirectionDCM;
// std::cout<<"toIECDirection " <<toIECDirection <<std::endl;
// std::cout<<"LocalizerImagDirectionDCM " <<LocalizerImagDirectionDCM <<std::endl;
// std::cout<<"LocalizerImagDirectionIEC " <<LocalizerImagDirectionIEC <<std::endl;
/* we calculate dot products between the Z components */ /* we calculate dot products between the Z components */
double dSumPA = 0; double dSumPA = 0;
dSumPA = dSumPA =
@ -1039,9 +959,6 @@ int itkImageProcessor::load2D(const char * pcFName){
(LocalizerImagDirectionIEC[1][2] * LATElementsIEC[5]) + (LocalizerImagDirectionIEC[1][2] * LATElementsIEC[5]) +
(LocalizerImagDirectionIEC[2][2] * LATElementsIEC[8]); (LocalizerImagDirectionIEC[2][2] * LATElementsIEC[8]);
// std::cout<<"dSumPA " <<dSumPA <<std::endl;
// std::cout<<"dSumLAT " <<dSumLAT <<std::endl;
tProjOrientationType tProjOrientationType
currProjOrientation = NA; currProjOrientation = NA;
@ -1065,7 +982,6 @@ int itkImageProcessor::load2D(const char * pcFName){
InternalImageType::Pointer MyLocalizerImage = InternalImageType::Pointer MyLocalizerImage =
caster2DInput->GetOutput(); caster2DInput->GetOutput();
//double* m_ImageIntensity;
DuplicatorType::Pointer m_Duplicator; DuplicatorType::Pointer m_Duplicator;
TopogramImageMetaInformation::Pointer m_TImageMeta; TopogramImageMetaInformation::Pointer m_TImageMeta;
@ -1077,10 +993,8 @@ int itkImageProcessor::load2D(const char * pcFName){
m_PASourceDupli = DuplicatorType::New(); m_PASourceDupli = DuplicatorType::New();
} }
//m_ImageIntensity = d_image1IntensityWindow;
m_Duplicator = m_PASourceDupli; m_Duplicator = m_PASourceDupli;
m_TImageMeta = m_TImage1MetaInfo; m_TImageMeta = m_TImage1MetaInfo;
// m_ImLoaded = &image2D1Loaded;
break; break;
@ -1091,9 +1005,7 @@ int itkImageProcessor::load2D(const char * pcFName){
m_LATSourceDupli = DuplicatorType::New(); m_LATSourceDupli = DuplicatorType::New();
} }
//m_ImageIntensity = d_image2IntensityWindow;
m_Duplicator = m_LATSourceDupli; m_Duplicator = m_LATSourceDupli;
// m_ImLoaded = &image2D2Loaded;
m_TImageMeta = m_TImage2MetaInfo; m_TImageMeta = m_TImage2MetaInfo;
break; break;
@ -1119,28 +1031,11 @@ int itkImageProcessor::load2D(const char * pcFName){
m_Duplicator->SetInputImage(caster2DInput->GetOutput() ); m_Duplicator->SetInputImage(caster2DInput->GetOutput() );
m_Duplicator->Update(); m_Duplicator->Update();
// InternalImageType::IndexType pIndex;
// pIndex[0]=200;
// pIndex[1]=300;
// InternalImageType::PixelType pPixel =
// m_Duplicator->GetOutput()->GetPixel(pIndex);
//std::cout<<"processro PIXEL: "<<pPixel <<std::endl;
// std::cout<< " ////////////// 2D Topo BEG " <<std::endl;
// std::cout<<"GetDirection()"<<m_Duplicator->GetOutput()->GetDirection()<<std::endl;
// std::cout<<"GetOrigin()"<<m_Duplicator->GetOutput()->GetOrigin()<<std::endl;
// std::cout<<"GetSpacing()"<<m_Duplicator->GetOutput()->GetSpacing()<<std::endl;
// std::cout<<"GetSize()"<<m_Duplicator->GetOutput()->GetLargestPossibleRegion().GetSize()<<std::endl;
// std::cout<< " ////////////// 2D Topo END " <<std::endl;
return return
(int) currProjOrientation; (int) currProjOrientation;
} }
double itkImageProcessor::GetLocalizerDisplayWindowLevel(int iImg) double itkImageProcessor::GetLocalizerDisplayWindowLevel(int iImg)
{ {
@ -1205,10 +1100,6 @@ double itkImageProcessor::GetLocalizerDisplayWindowWidth(int iImg)
return 0.; return 0.;
} }
Optimizer::ParametersType Optimizer::ParametersType
itkImageProcessor::GetFinalR23Parameters(){ itkImageProcessor::GetFinalR23Parameters(){
@ -1298,6 +1189,7 @@ void itkImageProcessor::SetOptimizer(std::string optimizer)
} }
void itkImageProcessor::SetMetric(std::string metric) void itkImageProcessor::SetMetric(std::string metric)
{ {
@ -1325,8 +1217,6 @@ void itkImageProcessor::SetHandleRotationImportOffset(eHandlingRotImpTransform h
} }
void itkImageProcessor::SetPowellOptimParameters( void itkImageProcessor::SetPowellOptimParameters(
double dStepT, double dStepT,
double dValTol, double dValTol,
@ -1364,7 +1254,6 @@ void itkImageProcessor::SetNCCMetricParameters(double dMaxT,bool bSm){
m_NCCMetricMetaInfo->SetSubtractMean(bSm); m_NCCMetricMetaInfo->SetSubtractMean(bSm);
} }
void itkImageProcessor::InitializeProjector() void itkImageProcessor::InitializeProjector()
{ {
@ -1504,7 +1393,6 @@ void itkImageProcessor::InitializeProjector()
filter2 = filter2 =
ChangeInformationFilterType::New(); ChangeInformationFilterType::New();
/* First of all we need the center of the Projection images in its reference frame */ /* First of all we need the center of the Projection images in its reference frame */
resampleFilter1->Update(); resampleFilter1->Update();
filter1->SetInput( resampleFilter1->GetOutput() ); filter1->SetInput( resampleFilter1->GetOutput() );
@ -1514,8 +1402,6 @@ void itkImageProcessor::InitializeProjector()
filter1->ChangeOriginOn(); filter1->ChangeOriginOn();
filter1->UpdateOutputInformation(); filter1->UpdateOutputInformation();
// std::cout<< "itkImageProcessor::InitializeProjector() " <<std::endl;
/* Again.. */ /* Again.. */
resampleFilter2->Update(); resampleFilter2->Update();
filter2->SetInput( resampleFilter2 ->GetOutput() ); filter2->SetInput( resampleFilter2 ->GetOutput() );
@ -1533,8 +1419,6 @@ void itkImageProcessor::InitializeProjector()
} }
itkImageProcessor::InternalImageType::DirectionType itkImageProcessor::InternalImageType::DirectionType
itkImageProcessor::CalcDRTImageDirections( itkImageProcessor::CalcDRTImageDirections(
double angle, double angle,
@ -1571,7 +1455,6 @@ int itkImageProcessor::unloadRTPlanAndMeta(){
return 0; return 0;
} }
void itkImageProcessor::loadRTPlanInfo( void itkImageProcessor::loadRTPlanInfo(
double dIsoX, double dIsoY, double dIsoZ, double dIsoX, double dIsoY, double dIsoZ,
double dLAT, double dVRT ,double dLNG){ double dLAT, double dVRT ,double dLNG){
@ -1607,7 +1490,6 @@ void itkImageProcessor::loadRTPlanInfo(
m_RTMetaInfo->SetIsocenterIECS(Point); m_RTMetaInfo->SetIsocenterIECS(Point);
ImageType3D::PointType ImageType3D::PointType
pZero (3); pZero (3);
pZero.Fill(0.); pZero.Fill(0.);
@ -1656,7 +1538,6 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
//TODO. //TODO.
} }
// FIRST // FIRST
ImageType3D::PointType NominalIsocenter_wZcorrectionLPS; ImageType3D::PointType NominalIsocenter_wZcorrectionLPS;
@ -1679,12 +1560,6 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
IsocenterOffsetLPS = m_CTMetaInfo->ConvertIECPointToLPSPoint( IsocenterOffsetLPS = m_CTMetaInfo->ConvertIECPointToLPSPoint(
m_DRTGeometryMetaInfo->GetProjectionCenterOffset1()); m_DRTGeometryMetaInfo->GetProjectionCenterOffset1());
// std::cout<< "///////////////// PGEOM META BEG ///////////////" <<std::endl;
// std::cout<<"NominalIsocenter IEC"<< m_DRTGeometryMetaInfo->GetProjectionCenter() <<std::endl;
// std::cout<<"CALIBRATION NominalIsocenter_wZcorrectionLPS "<<NominalIsocenter_wZcorrectionLPS<<std::endl;
// std::cout<<"CALIBRATION NominalIsocenterZero_wZcorrectionLPS "<<NominalIsocenterZero_wZcorrectionLPS<<std::endl;
// std::cout<<"CALIBRATION IsocenterOffsetLPS "<<IsocenterOffsetLPS<<std::endl;
ImageType3D::PointType CalibratedIsocenterLPS; ImageType3D::PointType CalibratedIsocenterLPS;
CalibratedIsocenterLPS[0] = NominalIsocenter_wZcorrectionLPS[0] + CalibratedIsocenterLPS[0] = NominalIsocenter_wZcorrectionLPS[0] +
@ -1694,7 +1569,6 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
CalibratedIsocenterLPS[2] = NominalIsocenter_wZcorrectionLPS[2] + CalibratedIsocenterLPS[2] = NominalIsocenter_wZcorrectionLPS[2] +
IsocenterOffsetLPS[2]; IsocenterOffsetLPS[2];
// std::cout<<"CALIBRATION CalibratedIsocenterLPS "<<CalibratedIsocenterLPS<<std::endl;
ImageType3D::PointType CalibratedIsocenterZeroLPS; ImageType3D::PointType CalibratedIsocenterZeroLPS;
@ -1704,7 +1578,6 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
IsocenterOffsetLPS[1] /*+ m_CTMetaInfo->GetSpacing()[1]/2*/; IsocenterOffsetLPS[1] /*+ m_CTMetaInfo->GetSpacing()[1]/2*/;
CalibratedIsocenterZeroLPS[2] = NominalIsocenterZero_wZcorrectionLPS[2] + CalibratedIsocenterZeroLPS[2] = NominalIsocenterZero_wZcorrectionLPS[2] +
IsocenterOffsetLPS[2] /*+ m_CTMetaInfo->GetSpacing()[2]/2*/; IsocenterOffsetLPS[2] /*+ m_CTMetaInfo->GetSpacing()[2]/2*/;
// std::cout<<"CALIBRATION CalibratedIsocenterZeroLPS "<<CalibratedIsocenterZeroLPS<<std::endl;
m_DRTImage1MetaInfo->SetProjectionAngleLPS( m_DRTImage1MetaInfo->SetProjectionAngleLPS(
this->CalcProjectionAngleLPS( this->CalcProjectionAngleLPS(
@ -1877,13 +1750,10 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
} }
/* /*
Nobody should go through all this... Nobody should go through all this...
To be very careful editing ... To be very careful editing ...
*/ */
itkImageProcessor::ImageType3D::PointType itkImageProcessor::ImageType3D::PointType
itkImageProcessor::CalcDRTImageOrigin( itkImageProcessor::CalcDRTImageOrigin(
ImageType3D::PointType m_DRTOrigin, ImageType3D::PointType m_DRTOrigin,
@ -1903,11 +1773,8 @@ itkImageProcessor::CalcDRTImageOrigin(
NewOrigin; NewOrigin;
} }
void itkImageProcessor::GetProjectionImages(){ void itkImageProcessor::GetProjectionImages(){
// std::cout<< "itkImageProcessor::GetProjectionImages" <<std::endl;
if(m_DRTImage1MetaInfo == NULL || if(m_DRTImage1MetaInfo == NULL ||
m_DRTImage2MetaInfo == NULL || m_DRTImage2MetaInfo == NULL ||
m_DRTGeometryMetaInfo == NULL || m_DRTGeometryMetaInfo == NULL ||
@ -1917,12 +1784,9 @@ void itkImageProcessor::GetProjectionImages(){
return; return;
} }
// const double dtr = (atan(1.0) * 4.0) / 180.0;
ImageType3D::PointType ZeroPoint; ImageType3D::PointType ZeroPoint;
ZeroPoint.Fill(0.); ZeroPoint.Fill(0.);
transform1->SetComputeZYX(true); transform1->SetComputeZYX(true);
transform1->SetIdentity(); transform1->SetIdentity();
@ -1948,18 +1812,6 @@ void itkImageProcessor::GetProjectionImages(){
transform1 ->SetCenter( transform1 ->SetCenter(
m_DRTImage1MetaInfo->GetProjectionOriginLPSZero()); m_DRTImage1MetaInfo->GetProjectionOriginLPSZero());
// std::cout<< "CurrTransform Rotations: "<<
// CurrTransform->GetAngleX() <<" "<<
// CurrTransform->GetAngleY() <<" "<<
// CurrTransform->GetAngleZ() <<" "<< std::endl;
// std::cout<< "CurrTransform Translations: "<<
// CurrTransform->GetTranslation()<<std::endl;
// std::cout<< "CurrTransform center: "<<
// CurrTransform->GetCenter()<<std::endl;
//transform1 ->Print(std::cout);
// The parameters of interpolator1, such as ProjectionAngle and FocalPointToIsocenterDistance // The parameters of interpolator1, such as ProjectionAngle and FocalPointToIsocenterDistance
// have been set before registration. Here we only need to replace the initial // have been set before registration. Here we only need to replace the initial
// transform with the final transform. // transform with the final transform.
@ -2043,8 +1895,6 @@ itkImageProcessor::CalcImportVolumeOffset(
ImageType3D::PointType IsoSupport_IECPos = ImageType3D::PointType IsoSupport_IECPos =
InputTransform->TransformPoint(rtCouchOffset ); InputTransform->TransformPoint(rtCouchOffset );
InternalImageType::DirectionType VolumeIECtoLPS; InternalImageType::DirectionType VolumeIECtoLPS;
VolumeIECtoLPS = VolumeLPStoIEC.GetTranspose(); VolumeIECtoLPS = VolumeLPStoIEC.GetTranspose();
@ -2065,7 +1915,6 @@ itkImageProcessor::CalcImportVolumeOffset(
} }
void itkImageProcessor::Write2DImages(){ void itkImageProcessor::Write2DImages(){
// using RescaleFilterType = itk::RescaleIntensityImageFilter<InternalImageType, OutputImageType>; // using RescaleFilterType = itk::RescaleIntensityImageFilter<InternalImageType, OutputImageType>;
@ -2139,46 +1988,6 @@ vtkImageData* itkImageProcessor::GetLocalizer1VTK()
toVTKLocalizer1->SetInput(rescaler1->GetOutput()); toVTKLocalizer1->SetInput(rescaler1->GetOutput());
toVTKLocalizer1->Update(); toVTKLocalizer1->Update();
// if(false) {
//// using ImageRegionType3D = ImageType3D::RegionType;
//// using SizeType3D = ImageRegionType3D::SizeType;
//// using ImageDirectionType3D = ImageType3D::DirectionType;
//// ImageRegionType3D region3D = rescaler1->GetOutput()->GetBufferedRegion();
//// SizeType3D size3D = region3D.GetSize();
//// //ImageType3D::PointType origin3D = rescaler1->GetOutput()->GetOrigin();
//// const itk::Vector<double, 3> resolution3D = rescaler1->GetOutput()->GetSpacing();
//// ImageDirectionType3D imagDirection = rescaler1->GetOutput()->GetDirection();
//// /* calculate image size in 3D Space */
//// 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 =
// // origin3D + (imagDirection * Dest);
// // std::cout<<" -------- Localizer 1 ITK --------"<<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 " <<origin3D <<std::endl;
// // std::cout<<"Last Voxel position: "<<LastVoxelPosition<<std::endl;
// // double* dBounds = toVTKLocalizer1->GetOutput()->GetBounds();
// // std::cout<< "-------- Localizer 1 VTK --------" <<std::endl;
// // std::cout<<"Bounds: "<<dBounds[0]<<" "<<dBounds[1]<<" "
// // <<dBounds[2]<<" "<<dBounds[3]<<" "
// // <<dBounds[4]<<" "<<dBounds[5]<<std::endl;
// // std::cout<< "-------- -------- --------" <<std::endl;
// }
return return
toVTKLocalizer1->GetOutput(); toVTKLocalizer1->GetOutput();
} }
@ -2197,46 +2006,6 @@ vtkImageData* itkImageProcessor::GetLocalizer2VTK()
toVTKLocalizer2->SetInput(rescaler2->GetOutput()); toVTKLocalizer2->SetInput(rescaler2->GetOutput());
toVTKLocalizer2->Update(); toVTKLocalizer2->Update();
// if(true) {
// using ImageRegionType3D = ImageType3D::RegionType;
// using SizeType3D = ImageRegionType3D::SizeType;
// using ImageDirectionType3D = ImageType3D::DirectionType;
// ImageRegionType3D region3D = rescaler2->GetOutput()->GetBufferedRegion();
// SizeType3D size3D = region3D.GetSize();
// ImageType3D::PointType origin3D = rescaler2->GetOutput()->GetOrigin();
// const itk::Vector<double, 3> resolution3D = rescaler2->GetOutput()->GetSpacing();
// ImageDirectionType3D imagDirection = rescaler2->GetOutput()->GetDirection();
// /* calculate image size in 3D Space */
// 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 =
// origin3D + (imagDirection * Dest);
// // std::cout<<" -------- Localizer 2 ITK --------"<<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 " <<origin3D <<std::endl;
// // std::cout<<"Last Voxel position: "<<LastVoxelPosition<<std::endl;
// // double* dBounds = toVTKLocalizer2->GetOutput()->GetBounds();
// // std::cout<< "-------- Localizer 2 VTK --------" <<std::endl;
// // std::cout<<"Bounds: "<<dBounds[0]<<" "<<dBounds[1]<<" "
// // <<dBounds[2]<<" "<<dBounds[3]<<" "
// // <<dBounds[4]<<" "<<dBounds[5]<<std::endl;
// // std::cout<< "-------- -------- --------" <<std::endl;
// }
return return
toVTKLocalizer2->GetOutput(); toVTKLocalizer2->GetOutput();
} }
@ -2300,49 +2069,6 @@ vtkImageData* itkImageProcessor::GetProjection1VTKToWrite()
toVTK2D1->SetInput(intWindowFilter->GetOutput()); toVTK2D1->SetInput(intWindowFilter->GetOutput());
toVTK2D1->Update(); 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;
// using ImageDirectionType3D = ImageType3D::DirectionType;
// ImageRegionType3D region3D = rescaler1->GetOutput()->GetBufferedRegion();
// SizeType3D size3D = region3D.GetSize();
// ImageType3D::PointType origin3D = rescaler1->GetOutput()->GetOrigin();
// const itk::Vector<double, 3> resolution3D = rescaler1->GetOutput()->GetSpacing();
// ImageDirectionType3D imagDirection = rescaler1->GetOutput()->GetDirection();
// /* calculate image size in 3D Space */
// 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 =
// origin3D + (imagDirection * Dest);
// std::cout<<" -------- Projection 1 ITK --------"<<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 " <<origin3D <<std::endl;
// std::cout<<"Last Voxel position: "<<LastVoxelPosition<<std::endl;
// double* dBounds = toVTK2D1->GetOutput()->GetBounds();
// std::cout<< "-------- Proj 1 --------" <<std::endl;
// std::cout<<"Bounds: "<<dBounds[0]<<" "<<dBounds[1]<<" "
// <<dBounds[2]<<" "<<dBounds[3]<<" "
// <<dBounds[4]<<" "<<dBounds[5]<<std::endl;
// std::cout<< "-------- -------- --------" <<std::endl;
return return
toVTK2D1->GetOutput(); toVTK2D1->GetOutput();
} }
@ -2393,8 +2119,6 @@ vtkMatrix4x4 * itkImageProcessor::GetProjection2VTKTransform()
m_Projection2VTKTransform->SetElement(2,3, m_Projection2VTKTransform->SetElement(2,3,
interpolator2->GetInverseTransform()->GetTranslation()[2]); interpolator2->GetInverseTransform()->GetTranslation()[2]);
return return
m_Projection2VTKTransform; m_Projection2VTKTransform;
@ -2426,8 +2150,6 @@ vtkImageData* itkImageProcessor::GetProjection2VTK()
toVTK2D2->GetOutput(); toVTK2D2->GetOutput();
} }
vtkImageData* itkImageProcessor::GetProjection2VTKToWrite() vtkImageData* itkImageProcessor::GetProjection2VTKToWrite()
{ {
if(m_DRTImage2MetaInfo == NULL || if(m_DRTImage2MetaInfo == NULL ||
@ -2457,54 +2179,9 @@ vtkImageData* itkImageProcessor::GetProjection2VTKToWrite()
intWindowFilter->SetInput(imageDRT2In); intWindowFilter->SetInput(imageDRT2In);
intWindowFilter->Update(); intWindowFilter->Update();
toVTK2D2->SetInput(intWindowFilter->GetOutput()); toVTK2D2->SetInput(intWindowFilter->GetOutput());
toVTK2D2->Update(); 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;
// using ImageDirectionType3D = ImageType3D::DirectionType;
// ImageRegionType3D region3D = rescaler2->GetOutput()->GetBufferedRegion();
// SizeType3D size3D = region3D.GetSize();
// ImageType3D::PointType origin3D = rescaler2->GetOutput()->GetOrigin();
// const itk::Vector<double, 3> resolution3D = rescaler2->GetOutput()->GetSpacing();
// ImageDirectionType3D imagDirection = rescaler2->GetOutput()->GetDirection();
/* calculate image size in 3D Space */
// 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 =
// origin3D + (imagDirection * Dest);
// std::cout<<" -------- Projection 2 ITK --------"<<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 " <<origin3D <<std::endl;
// std::cout<<"Last Voxel position: "<<LastVoxelPosition<<std::endl;
//double* dBounds = toVTK2D2->GetOutput()->GetBounds();
// std::cout<< "-------- Proj 2 --------" <<std::endl;
// std::cout<<"Bounds: "<<dBounds[0]<<" "<<dBounds[1]<<" "
// <<dBounds[2]<<" "<<dBounds[3]<<" "
// <<dBounds[4]<<" "<<dBounds[5]<<std::endl;
// std::cout<< "-------- -------- --------" <<std::endl;
return return
toVTK2D2->GetOutput(); toVTK2D2->GetOutput();
} }
@ -2519,14 +2196,11 @@ void itkImageProcessor::WriteProjectionImages()
rescaler1->SetOutputMinimum(0); rescaler1->SetOutputMinimum(0);
rescaler1->SetOutputMaximum(255); rescaler1->SetOutputMaximum(255);
rescaler1->SetInput( imageDRT1In ); rescaler1->SetInput( imageDRT1In );
// flipFilter1->GetOutput());
RescaleFilterType::Pointer rescaler2 = RescaleFilterType::New(); RescaleFilterType::Pointer rescaler2 = RescaleFilterType::New();
rescaler2->SetOutputMinimum(0); rescaler2->SetOutputMinimum(0);
rescaler2->SetOutputMaximum(255); rescaler2->SetOutputMaximum(255);
rescaler2->SetInput( imageDRT2In ); rescaler2->SetInput( imageDRT2In );
// flipFilter2->GetOutput());
using WriterType = itk::ImageFileWriter<OutputImageType>; using WriterType = itk::ImageFileWriter<OutputImageType>;
WriterType::Pointer writer1 = WriterType::New(); WriterType::Pointer writer1 = WriterType::New();
@ -2537,7 +2211,6 @@ void itkImageProcessor::WriteProjectionImages()
try try
{ {
// std::cout << "Writing image 1 " << std::endl;
writer1->Update(); writer1->Update();
} }
catch (itk::ExceptionObject & err) catch (itk::ExceptionObject & err)
@ -2551,7 +2224,6 @@ void itkImageProcessor::WriteProjectionImages()
try try
{ {
// std::cout << "Writing image 2" << std::endl;
writer2->Update(); writer2->Update();
} }
catch (itk::ExceptionObject & err) catch (itk::ExceptionObject & err)
@ -2562,10 +2234,6 @@ void itkImageProcessor::WriteProjectionImages()
} }
void itkImageProcessor::SetInitialTranslations(double dX, double dY, double dZ) void itkImageProcessor::SetInitialTranslations(double dX, double dY, double dZ)
{ {
@ -2590,7 +2258,6 @@ void itkImageProcessor::SetInitialRotations(double dX, double dY, double dZ)
m_TransformMetaInfo->SetUserRotations(Rotations); m_TransformMetaInfo->SetUserRotations(Rotations);
} }
Optimizer::ParametersType Optimizer::ParametersType
@ -2678,9 +2345,6 @@ void itkImageProcessor::SetRegionFixed1(
roiAutoReg1.SetIndex(index1); roiAutoReg1.SetIndex(index1);
roiAutoReg1.SetSize(size1); roiAutoReg1.SetSize(size1);
//std::cout << "itkImageProcessor " << std::endl;
//std::cout << roiAutoReg1 << std::endl;
this->m_R23->SetroiAutoReg1(roiAutoReg1); this->m_R23->SetroiAutoReg1(roiAutoReg1);
} }
@ -2703,21 +2367,12 @@ void itkImageProcessor::SetRegionFixed2(
roiAutoReg2.SetIndex(index2); roiAutoReg2.SetIndex(index2);
roiAutoReg2.SetSize(size2); roiAutoReg2.SetSize(size2);
//std::cout << "itkImageProcessor " << std::endl;
//std::cout << roiAutoReg2 << std::endl;
this->m_R23->SetroiAutoReg2(roiAutoReg2); this->m_R23->SetroiAutoReg2(roiAutoReg2);
} }
void itkImageProcessor::ResetROIRegions(){ void itkImageProcessor::ResetROIRegions(){
// auto region1temp = m_PASourceDupli->GetOutput()->GetBufferedRegion();
// auto region2temp = m_LATSourceDupli->GetOutput()->GetBufferedRegion();
// this->m_R23->SetroiAutoReg1(region1temp);
// this->m_R23->SetroiAutoReg2(region2temp);
this->m_R23->setROISizeToZero(); this->m_R23->setROISizeToZero();
} }

View File

@ -342,7 +342,6 @@ private:
imageDRT2In; imageDRT2In;
DuplicatorType::Pointer DuplicatorType::Pointer
m_LATSourceDupli, m_LATSourceDupli,
m_PASourceDupli, m_PASourceDupli,

View File

@ -63,8 +63,6 @@ MapTransformToNewOrigin(
return m_OutputTransform; return m_OutputTransform;
} }
TransformType::Pointer TransformType::Pointer
CalculateInternalTransformV3( CalculateInternalTransformV3(
ImageType3D::PointType m_Translation, //IEC ImageType3D::PointType m_Translation, //IEC

View File

@ -54,9 +54,6 @@ private:
bAbortProcessCommand; bAbortProcessCommand;
signals: signals:
void sendRegistrationProgress(int,double,double,double,double); void sendRegistrationProgress(int,double,double,double,double);
@ -67,7 +64,6 @@ namespace itk
class CommandIterationUpdate : public itk::Command { class CommandIterationUpdate : public itk::Command {
// TODO: Move to own files.
constexpr static unsigned int Dimension = 3; constexpr static unsigned int Dimension = 3;
@ -127,7 +123,6 @@ public:
objIterUpdate->setAbortFlag(false); objIterUpdate->setAbortFlag(false);
throw itk::ProcessAborted(); throw itk::ProcessAborted();
} }
// std::cout << "Progress: " << this->m_Process->GetAbortGenerateData() << std::endl;
OptimizerPointer optPow; OptimizerPointer optPow;
AmoebaOptimizerPointer optAm; AmoebaOptimizerPointer optAm;
@ -168,7 +163,6 @@ public:
}; };
class ExhaustiveCommandIterationUpdate : public itk::Command { class ExhaustiveCommandIterationUpdate : public itk::Command {
// TODO: Move to own files.
public: public:
using Self = ExhaustiveCommandIterationUpdate; using Self = ExhaustiveCommandIterationUpdate;

View File

@ -30,8 +30,6 @@ itkReg23::itkReg23()
registration->SetTransform1(Transform1); registration->SetTransform1(Transform1);
registration->SetTransform2(Transform2); registration->SetTransform2(Transform2);
// to be provided by the user // to be provided by the user
m_r23Meta = nullptr; m_r23Meta = nullptr;
m_Volume = nullptr; m_Volume = nullptr;
@ -44,14 +42,11 @@ itkReg23::itkReg23()
m_TransformMetaInfo = nullptr; m_TransformMetaInfo = nullptr;
m_OptimizerObserver = nullptr; m_OptimizerObserver = nullptr;
// m_UseFullROI = true; // if the full image ROI shall be used
m_UseDumptoFile = false; //If each (!) optimzer result shall be dumpped into a file. m_UseDumptoFile = false; //If each (!) optimzer result shall be dumpped into a file.
this->setROISizeToZero(); this->setROISizeToZero();
} }
itkReg23::~itkReg23() itkReg23::~itkReg23()
{ {
@ -124,21 +119,6 @@ void itkReg23::InitializeRegistration()
itkExceptionMacro(<< "m_interpolator2 data not present"); itkExceptionMacro(<< "m_interpolator2 data not present");
} }
// std::cout << "Print r23" <<
// m_r23Meta->GetMetricType() << " " << m_r23Meta->GetDegreeOfFreedom() << std::endl;
// std::cout << "Print Powell" <<
// m_PowellMeta->GetStepLength() << " " << m_PowellMeta->GetStepTolerance() << std::endl;
// std::cout << "Print Amoeba" <<
// m_AmoebaMeta->GetFunctionConvergenceTolerance() << " " << m_AmoebaMeta->GetSimplexDelta() << std::endl;
// std::cout << "Print NCC" <<
// m_NCCMeta->GetSubtractMean() << " " << m_NCCMeta->GetMaxTranslation() << std::endl;
// std::cout << "Print MI" <<
// m_MIMeta->GetMaxTranslation() << std::endl;
// ExhaustiveOptimizerType::StepsType steps(3);
// const int numberOfSteps = 25; //In each direction. Total number of steps is ((2*numberOfSteps+1))^3. For 25 -> 132651.
//const double stepLength = 0.1;
switch (m_r23Meta->GetOptimizerType()) { switch (m_r23Meta->GetOptimizerType()) {
case tOptimizerTypeEnum::POWELL: case tOptimizerTypeEnum::POWELL:
@ -197,14 +177,6 @@ void itkReg23::InitializeRegistration()
case tOptimizerTypeEnum::EXHAUSTIVE: case tOptimizerTypeEnum::EXHAUSTIVE:
std::cout<< "Using Extensive Optimizer" <<std::endl; std::cout<< "Using Extensive Optimizer" <<std::endl;
// steps[0] = numberOfSteps;
// steps[1] = numberOfSteps;
// steps[2] = numberOfSteps;
// ExhaustiveOptimizer->SetNumberOfSteps(steps);
// ExhaustiveOptimizer->SetStepLength(stepLength);
// registration->SetOptimizer(ExhaustiveOptimizer);
break; break;
default: default:
@ -288,17 +260,9 @@ void itkReg23::InitializeRegistration()
registration->SetIsocIECTransform(IsocTransform); registration->SetIsocIECTransform(IsocTransform);
// if (verbose) {
// registration->DebugOn();
// registration->Print(std::cout);
// }
std::cout << "#" << __COMPACT_PRETTY_FUNCTION__ << std::endl; std::cout << "#" << __COMPACT_PRETTY_FUNCTION__ << std::endl;
} }
int itkReg23::StartRegistration(std::string extraInfo) int itkReg23::StartRegistration(std::string extraInfo)
{ {
@ -306,8 +270,6 @@ int itkReg23::StartRegistration(std::string extraInfo)
// TODO: Check if the registartion pipeline has been initialized // TODO: Check if the registartion pipeline has been initialized
using ParametersType = RegistrationType::ParametersType; using ParametersType = RegistrationType::ParametersType;
//auto startParameters = transform1->GetParameters();
time_t t = time(0); // get time now time_t t = time(0); // get time now
struct tm* now = localtime(&t); struct tm* now = localtime(&t);
@ -323,9 +285,6 @@ int itkReg23::StartRegistration(std::string extraInfo)
fs << extraInfo; fs << extraInfo;
fs << "Value\tX\tY\tZ " << std::endl; fs << "Value\tX\tY\tZ " << std::endl;
// if (r23Meta->GetOptimizerType() == tOptimizerTypeEnum::EXHAUSTIVE) {
// ExhaustiveOptimizerObserver->set_stream(fs);
// }
} }
// Start the registration // Start the registration
@ -358,7 +317,6 @@ int itkReg23::StartRegistration(std::string extraInfo)
this->GetCurrentPosition(); this->GetCurrentPosition();
std::cout<<" FinalPars: "<< finalParameters <<std::endl; std::cout<<" FinalPars: "<< finalParameters <<std::endl;
std::cout << "#" << __COMPACT_PRETTY_FUNCTION__ << std::endl; std::cout << "#" << __COMPACT_PRETTY_FUNCTION__ << std::endl;
return 0; return 0;
@ -369,11 +327,9 @@ double itkReg23::GetOptimizerValue()
return m_OptmizerValue; return m_OptmizerValue;
} }
/** Get the cost function value for the current transform*/ /** Get the cost function value for the current transform*/
Optimizer::ParametersType itkReg23::GetCurrentPosition(){ Optimizer::ParametersType itkReg23::GetCurrentPosition(){
itk::Optimizer::ParametersType finalParameters; itk::Optimizer::ParametersType finalParameters;
switch (m_r23Meta->GetOptimizerType()) { switch (m_r23Meta->GetOptimizerType()) {
@ -434,6 +390,4 @@ double itkReg23::GetCurrentMetricValue()
} }
} }

View File

@ -161,6 +161,7 @@ private:
ExhaustiveOptimizer; ExhaustiveOptimizer;
/* ---- User provided */ /* ---- User provided */
R23MetaInformation::Pointer R23MetaInformation::Pointer
m_r23Meta; m_r23Meta;
@ -201,7 +202,6 @@ private:
/* ---- User provided END */ /* ---- User provided END */
TransformType::Pointer TransformType::Pointer
IsocTransform, IsocTransform,
Transform1, Transform1,

View File

@ -21,14 +21,12 @@ PowellOptimizerMetaInformation
Superclass::PrintSelf(os, indent); Superclass::PrintSelf(os, indent);
} }
PowellOptimizerMetaInformation PowellOptimizerMetaInformation
::~PowellOptimizerMetaInformation () ::~PowellOptimizerMetaInformation ()
{ {
} }
AmoebaOptimizerMetaInformation:: AmoebaOptimizerMetaInformation::
AmoebaOptimizerMetaInformation(){ AmoebaOptimizerMetaInformation(){
@ -39,7 +37,6 @@ AmoebaOptimizerMetaInformation(){
this->m_MaxIterations = 100; this->m_MaxIterations = 100;
} }
void void
AmoebaOptimizerMetaInformation AmoebaOptimizerMetaInformation
::PrintSelf(std::ostream& os, itk::Indent indent) const ::PrintSelf(std::ostream& os, itk::Indent indent) const
@ -47,14 +44,12 @@ AmoebaOptimizerMetaInformation
Superclass::PrintSelf(os, indent); Superclass::PrintSelf(os, indent);
} }
AmoebaOptimizerMetaInformation AmoebaOptimizerMetaInformation
::~AmoebaOptimizerMetaInformation () ::~AmoebaOptimizerMetaInformation ()
{ {
} }
MIMetricMetaInformation:: MIMetricMetaInformation::
MIMetricMetaInformation(){ MIMetricMetaInformation(){
@ -63,7 +58,6 @@ MIMetricMetaInformation(){
} }
void void
MIMetricMetaInformation MIMetricMetaInformation
::PrintSelf(std::ostream& os, itk::Indent indent) const ::PrintSelf(std::ostream& os, itk::Indent indent) const
@ -71,7 +65,6 @@ MIMetricMetaInformation
Superclass::PrintSelf(os, indent); Superclass::PrintSelf(os, indent);
} }
MIMetricMetaInformation MIMetricMetaInformation
::~MIMetricMetaInformation () ::~MIMetricMetaInformation ()
{ {
@ -86,7 +79,6 @@ NCCMetricMetaInformation(){
} }
void void
NCCMetricMetaInformation NCCMetricMetaInformation
::PrintSelf(std::ostream& os, itk::Indent indent) const ::PrintSelf(std::ostream& os, itk::Indent indent) const
@ -94,7 +86,6 @@ NCCMetricMetaInformation
Superclass::PrintSelf(os, indent); Superclass::PrintSelf(os, indent);
} }
NCCMetricMetaInformation NCCMetricMetaInformation
::~NCCMetricMetaInformation () ::~NCCMetricMetaInformation ()
{ {

View File

@ -173,7 +173,6 @@ private:
void operator=(const Self&); void operator=(const Self&);
}; };
class NCCMetricMetaInformation : class NCCMetricMetaInformation :
public itk::Object{ public itk::Object{
@ -205,8 +204,6 @@ protected:
bool m_SubtractMean; bool m_SubtractMean;
/** Default Constructor **/ /** Default Constructor **/
NCCMetricMetaInformation (); NCCMetricMetaInformation ();
/** Default Destructor **/ /** Default Destructor **/

View File

@ -53,7 +53,6 @@ vtkContourTopogramProjectionFilter::vtkContourTopogramProjectionFilter()
0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, vtkDataSetAttributes::SCALARS); 0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, vtkDataSetAttributes::SCALARS);
} }
vtkContourTopogramProjectionFilter::~vtkContourTopogramProjectionFilter() vtkContourTopogramProjectionFilter::~vtkContourTopogramProjectionFilter()
{ {
if (this->m_Transform) if (this->m_Transform)
@ -111,7 +110,6 @@ int vtkContourTopogramProjectionFilter::RequestData(
// If no points, then nothing to do. // If no points, then nothing to do.
if (points == nullptr) if (points == nullptr)
{ {
// std::cout << "Cannot Project; no input points" << std::endl;
vtkDebugMacro("Cannot Project; no input points"); vtkDebugMacro("Cannot Project; no input points");
return 1; return 1;
} }
@ -119,7 +117,6 @@ int vtkContourTopogramProjectionFilter::RequestData(
// If reference transform, then nothing to do. // If reference transform, then nothing to do.
if (m_RefTransform == nullptr) if (m_RefTransform == nullptr)
{ {
// std::cout << "Cannot Project; no input reference projection transform" << std::endl;
vtkDebugMacro("Cannot Project; no input reference projection transform"); vtkDebugMacro("Cannot Project; no input reference projection transform");
return 1; return 1;
} }
@ -127,7 +124,6 @@ int vtkContourTopogramProjectionFilter::RequestData(
// If transform, then nothing to do. // If transform, then nothing to do.
if (m_Transform == nullptr) if (m_Transform == nullptr)
{ {
// std::cout << "Cannot Project; no input projection transform" << std::endl;
vtkDebugMacro("Cannot Project; no input projection transform"); vtkDebugMacro("Cannot Project; no input projection transform");
return 1; return 1;
} }
@ -198,7 +194,6 @@ int vtkContourTopogramProjectionFilter::RequestData(
return 1; return 1;
} }
void vtkContourTopogramProjectionFilter::SetImportOffsetLPS(const double * dP) void vtkContourTopogramProjectionFilter::SetImportOffsetLPS(const double * dP)