Merge branch 'dicomNet' into 'master'
Basic Functionality - UI, DCMDB, DCMNet See merge request cpt_bioeng/drt!11
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 2.8.8)
|
cmake_minimum_required(VERSION 2.8.12)
|
||||||
|
|
||||||
SET(LIB_NAME itkDTRrecon)
|
SET(LIB_NAME itkDTRrecon)
|
||||||
|
|
||||||
@ -10,7 +10,6 @@ find_package(VTK REQUIRED)
|
|||||||
INCLUDE_DIRECTORIES(${VTK_INCLUDE_DIRS})
|
INCLUDE_DIRECTORIES(${VTK_INCLUDE_DIRS})
|
||||||
|
|
||||||
FIND_PACKAGE(GDCM REQUIRED)
|
FIND_PACKAGE(GDCM REQUIRED)
|
||||||
include(${GDCM_USE_FILE})
|
|
||||||
INCLUDE_DIRECTORIES(${GDCM_INCLUDE_DIRS})
|
INCLUDE_DIRECTORIES(${GDCM_INCLUDE_DIRS})
|
||||||
|
|
||||||
SET(SRCS
|
SET(SRCS
|
||||||
@ -34,7 +33,7 @@ SET(LINK_LIBS
|
|||||||
${LIB_NAME}
|
${LIB_NAME}
|
||||||
${VTK_LIBRARIES}
|
${VTK_LIBRARIES}
|
||||||
${ITK_LIBRARIES}
|
${ITK_LIBRARIES}
|
||||||
${GDCM_LIBRARIES}
|
gdcmMSFF
|
||||||
)
|
)
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(
|
TARGET_LINK_LIBRARIES(
|
||||||
@ -45,3 +44,7 @@ TARGET_LINK_LIBRARIES(
|
|||||||
target_include_directories (${LIB_NAME}
|
target_include_directories (${LIB_NAME}
|
||||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
set(EXTRA_LIBS ${EXTRA_LIBS} itkDTRrecon)
|
||||||
|
set(EXTRA_LIBS ${EXTRA_LIBS} PARENT_SCOPE)
|
||||||
|
@ -22,6 +22,7 @@ gfattori 08.11.2021
|
|||||||
#include "itkMatrix.h"
|
#include "itkMatrix.h"
|
||||||
#include "itkGDCMSeriesFileNames.h"
|
#include "itkGDCMSeriesFileNames.h"
|
||||||
#include "itkOrientImageFilter.h"
|
#include "itkOrientImageFilter.h"
|
||||||
|
#include <gdcmIPPSorter.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -284,12 +285,12 @@ void itkImageProcessor::SetCustom_ImportTransform(double dTx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void itkImageProcessor::SetCustom_ProjectionCenterOffsetFixedAxes_IEC(
|
void itkImageProcessor::SetCustom_ProjectionCenterOffsetFixedAxes_IEC(
|
||||||
double dX1,
|
double dX1,
|
||||||
double dY1,
|
double dY1,
|
||||||
double dZ1,
|
double dZ1,
|
||||||
double dX2,
|
double dX2,
|
||||||
double dY2,
|
double dY2,
|
||||||
double dZ2)
|
double dZ2)
|
||||||
{
|
{
|
||||||
|
|
||||||
typedef itk::Point<double, 3> PointType;
|
typedef itk::Point<double, 3> PointType;
|
||||||
@ -369,8 +370,108 @@ void itkImageProcessor::SetCustom_2Dsize(int nX1, int nY1,int nX2,int nY2)
|
|||||||
//TODO UPDATE TO FOLLOW
|
//TODO UPDATE TO FOLLOW
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int itkImageProcessor::load3DSerieFromFiles( std::vector<std::string> v_fnames){
|
||||||
|
|
||||||
int itkImageProcessor::load3DSerie(const char * pcDirName)
|
tPatOrientation m_PatOrientation
|
||||||
|
= tPatOrientation::NotDefined;
|
||||||
|
|
||||||
|
/* Since are not sure DB indexer to sort images,
|
||||||
|
* we run the IPP sorter here. */
|
||||||
|
using IppSorterType = gdcm::IPPSorter;
|
||||||
|
IppSorterType ZSorter;
|
||||||
|
|
||||||
|
ZSorter.SetComputeZSpacing( true );
|
||||||
|
ZSorter.SetZSpacingTolerance( 1e-3 );
|
||||||
|
bool b = ZSorter.Sort(v_fnames);
|
||||||
|
if( !b )
|
||||||
|
{
|
||||||
|
std::cerr << "itkImageProcessor::load3DSerieFromFiles :: Failed to sort files based on IPP." << std::endl;
|
||||||
|
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 =
|
||||||
|
ZSorter.GetFilenames();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
using ImageIOType = itk::GDCMImageIO;
|
||||||
|
ImageIOType::Pointer dicomIO = ImageIOType::New();
|
||||||
|
|
||||||
|
ImageSeriesReaderType3D::Pointer
|
||||||
|
imageSeriesReader3D = ImageSeriesReaderType3D::New();
|
||||||
|
|
||||||
|
imageSeriesReader3D->SetImageIO(dicomIO);
|
||||||
|
imageSeriesReader3D->SetFileNames(v_sortedFnames);
|
||||||
|
//imageSeriesReader3D->SetNumberOfWorkUnits(8);
|
||||||
|
imageSeriesReader3D->ForceOrthogonalDirectionOff(); // properly read CTs with gantry tilt
|
||||||
|
//imageSeriesReader3D->SetSpacingWarningRelThreshold();
|
||||||
|
|
||||||
|
imageSeriesReader3D->Update();
|
||||||
|
|
||||||
|
if(v_fnames.size()>0){
|
||||||
|
|
||||||
|
gdcm::Reader R;
|
||||||
|
R.SetFileName(v_sortedFnames.at(0).c_str());
|
||||||
|
if(!R.Read())
|
||||||
|
{
|
||||||
|
cerr<<"ERROR: cannot read file: "<<v_sortedFnames.at(0).c_str()<<endl;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
const gdcm::File &file = R.GetFile();
|
||||||
|
const gdcm::DataSet &ds = file.GetDataSet();
|
||||||
|
|
||||||
|
char* sTmpString = new char [255];
|
||||||
|
strcpy( sTmpString,gGetStringValueFromTag( gdcm::Tag(0x0018,0x5100), ds));
|
||||||
|
*std::remove(sTmpString, sTmpString + strlen(sTmpString), ' ') = 0;
|
||||||
|
|
||||||
|
if(!strcmp(sTmpString,ImageOrientationStrings[eImageOrientationType::HFS])){
|
||||||
|
m_PatOrientation = eImageOrientationType::HFS;
|
||||||
|
} else if(!strcmp(sTmpString,ImageOrientationStrings[eImageOrientationType::FFS])){
|
||||||
|
m_PatOrientation = eImageOrientationType::FFS;
|
||||||
|
} else {
|
||||||
|
m_PatOrientation = eImageOrientationType::NotDefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete [] (sTmpString);
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CastFilterType3D::Pointer caster3D =
|
||||||
|
CastFilterType3D::New();
|
||||||
|
|
||||||
|
caster3D->SetInput(imageSeriesReader3D->GetOutput());
|
||||||
|
caster3D->Update();
|
||||||
|
|
||||||
|
m_VolumeSourceDupli->SetInputImage(caster3D->GetOutput());
|
||||||
|
m_VolumeSourceDupli->Update();
|
||||||
|
|
||||||
|
caster3D = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (itk::ExceptionObject & ex)
|
||||||
|
{
|
||||||
|
std::cout << ex << std::endl;
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
InternalImageType::Pointer m_InputImage =
|
||||||
|
m_VolumeSourceDupli->GetOutput();
|
||||||
|
return
|
||||||
|
this->fill3DVolumeMeta(m_InputImage, m_PatOrientation);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int itkImageProcessor::load3DSerieFromFolder(const char * pcDirName)
|
||||||
{
|
{
|
||||||
|
|
||||||
using NamesGeneratorType = itk::GDCMSeriesFileNames;
|
using NamesGeneratorType = itk::GDCMSeriesFileNames;
|
||||||
@ -402,7 +503,7 @@ int itkImageProcessor::load3DSerie(const char * pcDirName)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "No DICOMs in: " << pcDirName << std::endl;
|
std::cout << "No DICOMs in: " << pcDirName << std::endl;
|
||||||
return EXIT_SUCCESS;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (seriesItr != seriesEnd)
|
while (seriesItr != seriesEnd)
|
||||||
@ -467,7 +568,7 @@ int itkImageProcessor::load3DSerie(const char * pcDirName)
|
|||||||
m_PatOrientation = eImageOrientationType::NotDefined;
|
m_PatOrientation = eImageOrientationType::NotDefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
free (sTmpString);
|
delete [] (sTmpString);
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -493,9 +594,17 @@ int itkImageProcessor::load3DSerie(const char * pcDirName)
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
InternalImageType::Pointer m_InputImage =
|
InternalImageType::Pointer m_InputImage =
|
||||||
m_VolumeSourceDupli->GetOutput();
|
m_VolumeSourceDupli->GetOutput();
|
||||||
|
return
|
||||||
|
this->fill3DVolumeMeta(m_InputImage, m_PatOrientation);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Fill Meta after 3D volume load */
|
||||||
|
int itkImageProcessor::fill3DVolumeMeta(
|
||||||
|
InternalImageType::Pointer m_InputImage,
|
||||||
|
tPatOrientation m_PatOrientation){
|
||||||
|
|
||||||
|
|
||||||
if(m_CTMetaInfo != NULL){
|
if(m_CTMetaInfo != NULL){
|
||||||
@ -597,9 +706,9 @@ int itkImageProcessor::load3DSerie(const char * pcDirName)
|
|||||||
image3DIn =
|
image3DIn =
|
||||||
m_3DInputChangeInformationToZero->GetOutput();
|
m_3DInputChangeInformationToZero->GetOutput();
|
||||||
|
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector <double> itkImageProcessor::GetRTImportOffset()
|
const std::vector <double> itkImageProcessor::GetRTImportOffset()
|
||||||
@ -1176,7 +1285,7 @@ void itkImageProcessor::InitializeProjector()
|
|||||||
|
|
||||||
//AAAAAA TODOOOOO CERCA
|
//AAAAAA TODOOOOO CERCA
|
||||||
ImageType3D::PointType pFakeIsoLPS =
|
ImageType3D::PointType pFakeIsoLPS =
|
||||||
m_DRTImage1MetaInfo->GetProjectionOriginLPS();
|
m_DRTImage1MetaInfo->GetProjectionOriginLPS();
|
||||||
|
|
||||||
//ImageType3D::PointType pFakeIsoLPS =
|
//ImageType3D::PointType pFakeIsoLPS =
|
||||||
// m_CTMetaInfo->GetProjectionOriginLPS(
|
// m_CTMetaInfo->GetProjectionOriginLPS(
|
||||||
@ -1249,7 +1358,7 @@ void itkImageProcessor::InitializeProjector()
|
|||||||
if(m_RTMetaInfo == NULL)
|
if(m_RTMetaInfo == NULL)
|
||||||
{
|
{
|
||||||
ImageType3D::PointType pFakeIsoLPS =
|
ImageType3D::PointType pFakeIsoLPS =
|
||||||
m_DRTImage2MetaInfo->GetProjectionOriginLPS();
|
m_DRTImage2MetaInfo->GetProjectionOriginLPS();
|
||||||
|
|
||||||
//ImageType3D::PointType pFakeIsoLPS =
|
//ImageType3D::PointType pFakeIsoLPS =
|
||||||
// m_CTMetaInfo->GetProjectionOriginLPS(
|
// m_CTMetaInfo->GetProjectionOriginLPS(
|
||||||
@ -1317,17 +1426,17 @@ void itkImageProcessor::InitializeProjector()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// // 2D Image 2
|
// // 2D Image 2
|
||||||
// interpolator2->SetProjectionAngle(
|
// interpolator2->SetProjectionAngle(
|
||||||
// dtr *
|
// dtr *
|
||||||
// m_DRTImage2MetaInfo->GetProjectionAngleLPS() );
|
// m_DRTImage2MetaInfo->GetProjectionAngleLPS() );
|
||||||
// interpolator2->SetFocalPointToIsocenterDistance(
|
// interpolator2->SetFocalPointToIsocenterDistance(
|
||||||
// m_DRTImage2MetaInfo->GetSCD());
|
// m_DRTImage2MetaInfo->GetSCD());
|
||||||
// interpolator2->SetThreshold(
|
// interpolator2->SetThreshold(
|
||||||
// m_DRTGeometryMetaInfo->GetIntensityThreshold()
|
// m_DRTGeometryMetaInfo->GetIntensityThreshold()
|
||||||
// );
|
// );
|
||||||
// interpolator2->SetTransform(transform);
|
// interpolator2->SetTransform(transform);
|
||||||
// interpolator2->Initialize();
|
// interpolator2->Initialize();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1518,10 +1627,10 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
|
|||||||
|
|
||||||
ImageType3D::PointType NominalIsocenterZero_wZcorrectionLPS;
|
ImageType3D::PointType NominalIsocenterZero_wZcorrectionLPS;
|
||||||
|
|
||||||
NominalIsocenterZero_wZcorrectionLPS =
|
NominalIsocenterZero_wZcorrectionLPS =
|
||||||
m_CTMetaInfo->GetProjectionOriginLPSZero(
|
m_CTMetaInfo->GetProjectionOriginLPSZero(
|
||||||
m_DRTGeometryMetaInfo->GetProjectionCenter()
|
m_DRTGeometryMetaInfo->GetProjectionCenter()
|
||||||
);
|
);
|
||||||
|
|
||||||
std::cout<< "///////////////// PGEOM META BEG ///////////////" <<std::endl;
|
std::cout<< "///////////////// PGEOM META BEG ///////////////" <<std::endl;
|
||||||
|
|
||||||
@ -1571,13 +1680,13 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
|
|||||||
NominalIsocenter_wZcorrectionLPS//m_DRTImage1MetaInfo->GetProjectionOriginLPS()
|
NominalIsocenter_wZcorrectionLPS//m_DRTImage1MetaInfo->GetProjectionOriginLPS()
|
||||||
);
|
);
|
||||||
|
|
||||||
std::cout<<"Bounds1: "
|
std::cout<<"Bounds1: "
|
||||||
<<vBounds.data()[0]<<" "
|
<<vBounds.data()[0]<<" "
|
||||||
<<vBounds.data()[1]<<" "
|
<<vBounds.data()[1]<<" "
|
||||||
<<vBounds.data()[2]<<" "
|
<<vBounds.data()[2]<<" "
|
||||||
<<vBounds.data()[3]<<" "
|
<<vBounds.data()[3]<<" "
|
||||||
<<vBounds.data()[4]<<" "
|
<<vBounds.data()[4]<<" "
|
||||||
<<vBounds.data()[5]<<std::endl;
|
<<vBounds.data()[5]<<std::endl;
|
||||||
|
|
||||||
m_DRTImage1MetaInfo->SetSizeWithBounds(
|
m_DRTImage1MetaInfo->SetSizeWithBounds(
|
||||||
vBounds.data(),
|
vBounds.data(),
|
||||||
@ -1593,8 +1702,8 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
|
|||||||
m_DRTImage1MetaInfo->GetCOV(),
|
m_DRTImage1MetaInfo->GetCOV(),
|
||||||
NominalIsocenter_wZcorrectionLPS,//m_DRTImage1MetaInfo->GetProjectionOriginLPS(),
|
NominalIsocenter_wZcorrectionLPS,//m_DRTImage1MetaInfo->GetProjectionOriginLPS(),
|
||||||
this->CalcProjectionAngleLPS(
|
this->CalcProjectionAngleLPS(
|
||||||
m_CTMetaInfo->GetPatientOrientation(),
|
m_CTMetaInfo->GetPatientOrientation(),
|
||||||
m_DRTGeometryMetaInfo->GetProjectionAngle1IEC() ),
|
m_DRTGeometryMetaInfo->GetProjectionAngle1IEC() ),
|
||||||
//m_DRTGeometryMetaInfo->GetProjectionAngle1IEC(),// m_DRTImage1MetaInfo->GetProjectionAngleLPS(),
|
//m_DRTGeometryMetaInfo->GetProjectionAngle1IEC(),// m_DRTImage1MetaInfo->GetProjectionAngleLPS(),
|
||||||
Std_DRT2LPS
|
Std_DRT2LPS
|
||||||
)
|
)
|
||||||
@ -1605,9 +1714,9 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
|
|||||||
m_DRTImage1MetaInfo->SetImageDirectionsLPS(
|
m_DRTImage1MetaInfo->SetImageDirectionsLPS(
|
||||||
CalcDRTImageDirections(
|
CalcDRTImageDirections(
|
||||||
this->CalcProjectionAngleLPS(
|
this->CalcProjectionAngleLPS(
|
||||||
m_CTMetaInfo->GetPatientOrientation(),
|
m_CTMetaInfo->GetPatientOrientation(),
|
||||||
m_DRTGeometryMetaInfo->GetProjectionAngle1IEC()),
|
m_DRTGeometryMetaInfo->GetProjectionAngle1IEC()),
|
||||||
//m_DRTGeometryMetaInfo->GetProjectionAngle1IEC(),//m_DRTImage1MetaInfo->GetProjectionAngleLPS(),
|
//m_DRTGeometryMetaInfo->GetProjectionAngle1IEC(),//m_DRTImage1MetaInfo->GetProjectionAngleLPS(),
|
||||||
Std_DRT2LPS)
|
Std_DRT2LPS)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1648,15 +1757,15 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
|
|||||||
|
|
||||||
m_DRTImage2MetaInfo->SetProjectionOriginLPS(
|
m_DRTImage2MetaInfo->SetProjectionOriginLPS(
|
||||||
CalibratedIsocenterLPS);
|
CalibratedIsocenterLPS);
|
||||||
// m_CTMetaInfo->GetProjectionOriginLPS(
|
// m_CTMetaInfo->GetProjectionOriginLPS(
|
||||||
// m_DRTGeometryMetaInfo->GetProjectionCenter2())
|
// m_DRTGeometryMetaInfo->GetProjectionCenter2())
|
||||||
// );
|
// );
|
||||||
|
|
||||||
m_DRTImage2MetaInfo->SetProjectionOriginLPSZero(
|
m_DRTImage2MetaInfo->SetProjectionOriginLPSZero(
|
||||||
CalibratedIsocenterZeroLPS);
|
CalibratedIsocenterZeroLPS);
|
||||||
// m_CTMetaInfo->GetProjectionOriginLPSZero(
|
// m_CTMetaInfo->GetProjectionOriginLPSZero(
|
||||||
// m_DRTGeometryMetaInfo->GetProjectionCenter2())
|
// m_DRTGeometryMetaInfo->GetProjectionCenter2())
|
||||||
// );
|
// );
|
||||||
|
|
||||||
vBounds.clear();
|
vBounds.clear();
|
||||||
vBounds = m_CTMetaInfo->CalculateRegions(
|
vBounds = m_CTMetaInfo->CalculateRegions(
|
||||||
@ -1664,12 +1773,12 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
|
|||||||
);
|
);
|
||||||
|
|
||||||
std::cout<<"Bounds2: "
|
std::cout<<"Bounds2: "
|
||||||
<<vBounds.data()[0]<<" "
|
<<vBounds.data()[0]<<" "
|
||||||
<<vBounds.data()[1]<<" "
|
<<vBounds.data()[1]<<" "
|
||||||
<<vBounds.data()[2]<<" "
|
<<vBounds.data()[2]<<" "
|
||||||
<<vBounds.data()[3]<<" "
|
<<vBounds.data()[3]<<" "
|
||||||
<<vBounds.data()[4]<<" "
|
<<vBounds.data()[4]<<" "
|
||||||
<<vBounds.data()[5]<<std::endl;
|
<<vBounds.data()[5]<<std::endl;
|
||||||
|
|
||||||
m_DRTImage2MetaInfo->SetSizeWithBounds(
|
m_DRTImage2MetaInfo->SetSizeWithBounds(
|
||||||
vBounds.data(),
|
vBounds.data(),
|
||||||
@ -1683,9 +1792,9 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
|
|||||||
m_DRTImage2MetaInfo->GetCOV(),
|
m_DRTImage2MetaInfo->GetCOV(),
|
||||||
NominalIsocenter_wZcorrectionLPS,//m_DRTImage2MetaInfo->GetProjectionOriginLPS(),
|
NominalIsocenter_wZcorrectionLPS,//m_DRTImage2MetaInfo->GetProjectionOriginLPS(),
|
||||||
this->CalcProjectionAngleLPS(
|
this->CalcProjectionAngleLPS(
|
||||||
m_CTMetaInfo->GetPatientOrientation(),
|
m_CTMetaInfo->GetPatientOrientation(),
|
||||||
m_DRTGeometryMetaInfo->GetProjectionAngle2IEC()) ,
|
m_DRTGeometryMetaInfo->GetProjectionAngle2IEC()) ,
|
||||||
//m_DRTGeometryMetaInfo->GetProjectionAngle2IEC(),//m_DRTImage2MetaInfo->GetProjectionAngleLPS(),
|
//m_DRTGeometryMetaInfo->GetProjectionAngle2IEC(),//m_DRTImage2MetaInfo->GetProjectionAngleLPS(),
|
||||||
Std_DRT2LPS
|
Std_DRT2LPS
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -1693,8 +1802,8 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
|
|||||||
m_DRTImage2MetaInfo->SetImageDirectionsLPS(
|
m_DRTImage2MetaInfo->SetImageDirectionsLPS(
|
||||||
CalcDRTImageDirections(
|
CalcDRTImageDirections(
|
||||||
this->CalcProjectionAngleLPS(
|
this->CalcProjectionAngleLPS(
|
||||||
m_CTMetaInfo->GetPatientOrientation(),
|
m_CTMetaInfo->GetPatientOrientation(),
|
||||||
m_DRTGeometryMetaInfo->GetProjectionAngle2IEC()) ,
|
m_DRTGeometryMetaInfo->GetProjectionAngle2IEC()) ,
|
||||||
//m_DRTGeometryMetaInfo->GetProjectionAngle2IEC(),//m_DRTImage2MetaInfo->GetProjectionAngleLPS(),
|
//m_DRTGeometryMetaInfo->GetProjectionAngle2IEC(),//m_DRTImage2MetaInfo->GetProjectionAngleLPS(),
|
||||||
Std_DRT2LPS)
|
Std_DRT2LPS)
|
||||||
);
|
);
|
||||||
@ -1773,8 +1882,8 @@ void itkImageProcessor::GetProjectionImages(){
|
|||||||
|
|
||||||
ImageType3D::PointType pFakeIsoLPS =
|
ImageType3D::PointType pFakeIsoLPS =
|
||||||
m_DRTImage1MetaInfo->GetProjectionOriginLPS();
|
m_DRTImage1MetaInfo->GetProjectionOriginLPS();
|
||||||
//m_CTMetaInfo->GetProjectionOriginLPS(
|
//m_CTMetaInfo->GetProjectionOriginLPS(
|
||||||
// m_DRTGeometryMetaInfo->GetProjectionCenter());
|
// m_DRTGeometryMetaInfo->GetProjectionCenter());
|
||||||
|
|
||||||
std::cout<<"pFakeIsoLPS: "<<std::endl;
|
std::cout<<"pFakeIsoLPS: "<<std::endl;
|
||||||
|
|
||||||
@ -1818,9 +1927,9 @@ void itkImageProcessor::GetProjectionImages(){
|
|||||||
CurrTransform->GetAngleZ()
|
CurrTransform->GetAngleZ()
|
||||||
);
|
);
|
||||||
|
|
||||||
std::cout<< "itkImageProcessor::GetProjectionImages" <<std::endl;
|
std::cout<< "itkImageProcessor::GetProjectionImages" <<std::endl;
|
||||||
|
|
||||||
// AAAAAAA TODOOO CERCAA
|
// AAAAAAA TODOOO CERCAA
|
||||||
transform1 ->SetCenter(
|
transform1 ->SetCenter(
|
||||||
m_DRTImage1MetaInfo->GetProjectionOriginLPSZero());
|
m_DRTImage1MetaInfo->GetProjectionOriginLPSZero());
|
||||||
|
|
||||||
@ -1851,65 +1960,65 @@ void itkImageProcessor::GetProjectionImages(){
|
|||||||
//CurrTransform->SetComputeZYX(true);
|
//CurrTransform->SetComputeZYX(true);
|
||||||
//CurrTransform->SetIdentity();
|
//CurrTransform->SetIdentity();
|
||||||
|
|
||||||
if(m_RTMetaInfo == NULL)
|
if(m_RTMetaInfo == NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
ImageType3D::PointType pFakeIsoLPS =
|
ImageType3D::PointType pFakeIsoLPS =
|
||||||
m_DRTImage2MetaInfo->GetProjectionOriginLPS();
|
m_DRTImage2MetaInfo->GetProjectionOriginLPS();
|
||||||
//m_CTMetaInfo->GetProjectionOriginLPS(
|
//m_CTMetaInfo->GetProjectionOriginLPS(
|
||||||
// m_DRTGeometryMetaInfo->GetProjectionCenter());
|
// m_DRTGeometryMetaInfo->GetProjectionCenter());
|
||||||
|
|
||||||
std::cout<<"pFakeIsoLPS: "<<std::endl;
|
std::cout<<"pFakeIsoLPS: "<<std::endl;
|
||||||
|
|
||||||
CurrTransform =
|
CurrTransform =
|
||||||
CalculateInternalTransform(
|
CalculateInternalTransform(
|
||||||
ZeroPoint,
|
ZeroPoint,
|
||||||
ZeroPoint,
|
ZeroPoint,
|
||||||
m_TransformMetaInfo->GetTranslations(),
|
m_TransformMetaInfo->GetTranslations(),
|
||||||
m_TransformMetaInfo->GetRotations(),
|
m_TransformMetaInfo->GetRotations(),
|
||||||
m_DRTImage2MetaInfo->GetProjectionOriginLPS(),
|
m_DRTImage2MetaInfo->GetProjectionOriginLPS(),
|
||||||
pFakeIsoLPS,
|
pFakeIsoLPS,
|
||||||
ZeroPoint,
|
ZeroPoint,
|
||||||
IECtoLPS_Directions
|
IECtoLPS_Directions
|
||||||
);
|
|
||||||
|
|
||||||
std::cout<<"pFakeIsoLPS: "<<std::endl;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
CurrTransform =
|
|
||||||
CalculateInternalTransform(
|
|
||||||
ZeroPoint ,
|
|
||||||
m_DRTGeometryMetaInfo->GetIECS2IECScannerR(),
|
|
||||||
m_TransformMetaInfo->GetTranslations(),
|
|
||||||
m_TransformMetaInfo->GetRotations(),
|
|
||||||
m_DRTImage2MetaInfo->GetProjectionOriginLPS(),
|
|
||||||
m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetImportOffset(),
|
|
||||||
m_CTMetaInfo->GetImportOffset(),
|
|
||||||
IECtoLPS_Directions
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
transform2->SetComputeZYX(true);
|
|
||||||
transform2->SetIdentity();
|
|
||||||
|
|
||||||
transform2->SetTranslation(
|
|
||||||
CurrTransform->GetTranslation());
|
|
||||||
transform2->SetRotation(
|
|
||||||
CurrTransform->GetAngleX(),
|
|
||||||
CurrTransform->GetAngleY(),
|
|
||||||
CurrTransform->GetAngleZ()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
std::cout<<"pFakeIsoLPS: "<<std::endl;
|
||||||
|
|
||||||
transform2 ->SetCenter(
|
} else {
|
||||||
m_DRTImage2MetaInfo->GetProjectionOriginLPSZero());
|
|
||||||
|
CurrTransform =
|
||||||
|
CalculateInternalTransform(
|
||||||
|
ZeroPoint ,
|
||||||
|
m_DRTGeometryMetaInfo->GetIECS2IECScannerR(),
|
||||||
|
m_TransformMetaInfo->GetTranslations(),
|
||||||
|
m_TransformMetaInfo->GetRotations(),
|
||||||
|
m_DRTImage2MetaInfo->GetProjectionOriginLPS(),
|
||||||
|
m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetImportOffset(),
|
||||||
|
m_CTMetaInfo->GetImportOffset(),
|
||||||
|
IECtoLPS_Directions
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//transform2 ->Print(std::cout);
|
|
||||||
|
transform2->SetComputeZYX(true);
|
||||||
|
transform2->SetIdentity();
|
||||||
|
|
||||||
|
transform2->SetTranslation(
|
||||||
|
CurrTransform->GetTranslation());
|
||||||
|
transform2->SetRotation(
|
||||||
|
CurrTransform->GetAngleX(),
|
||||||
|
CurrTransform->GetAngleY(),
|
||||||
|
CurrTransform->GetAngleZ()
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
transform2 ->SetCenter(
|
||||||
|
m_DRTImage2MetaInfo->GetProjectionOriginLPSZero());
|
||||||
|
|
||||||
|
|
||||||
|
//transform2 ->Print(std::cout);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1928,10 +2037,10 @@ void itkImageProcessor::GetProjectionImages(){
|
|||||||
imageDRT2In = filter2->GetOutput();
|
imageDRT2In = filter2->GetOutput();
|
||||||
std::cout<< "itkImageProcessor::GetProjectionImages END" <<std::endl;
|
std::cout<< "itkImageProcessor::GetProjectionImages END" <<std::endl;
|
||||||
|
|
||||||
// std::cout<<"MMMMM: "<<
|
// std::cout<<"MMMMM: "<<
|
||||||
// interpolator1->GetInverseTransform()->GetMatrix()<<std::endl;
|
// interpolator1->GetInverseTransform()->GetMatrix()<<std::endl;
|
||||||
// std::cout<<"MMMMM: "<<
|
// std::cout<<"MMMMM: "<<
|
||||||
// interpolator1->GetInverseTransform()->GetTranslation()<<std::endl;
|
// interpolator1->GetInverseTransform()->GetTranslation()<<std::endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,9 @@ public:
|
|||||||
itkTypeMacro(itkImageProcessor, Object);
|
itkTypeMacro(itkImageProcessor, Object);
|
||||||
|
|
||||||
/** Input data load methods*/
|
/** Input data load methods*/
|
||||||
int load3DSerie(const char* );
|
int load3DSerieFromFolder(const char* );
|
||||||
|
int load3DSerieFromFiles( std::vector<std::string> );
|
||||||
|
|
||||||
int load2D(const char *);
|
int load2D(const char *);
|
||||||
|
|
||||||
void loadRTPlanInfo(double, double, double, double, double ,double);
|
void loadRTPlanInfo(double, double, double, double, double ,double);
|
||||||
@ -151,13 +153,13 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** Various pixel types */
|
/** Various pixel types */
|
||||||
using InternalPixelType = float;
|
using InternalPixelType = float;
|
||||||
using PixelType2D = short;
|
using PixelType2D = short;
|
||||||
using PixelType3D = short;
|
using PixelType3D = short;
|
||||||
using OutputPixelType = unsigned char;
|
using OutputPixelType = unsigned char;
|
||||||
|
|
||||||
using ImageType3D = itk::Image<PixelType3D, Dimension>;
|
using ImageType3D = itk::Image<PixelType3D, Dimension>;
|
||||||
using InternalImageType = itk::Image<InternalPixelType, Dimension>;
|
using InternalImageType = itk::Image<InternalPixelType, Dimension>;
|
||||||
|
|
||||||
itkImageProcessor();
|
itkImageProcessor();
|
||||||
virtual ~itkImageProcessor();
|
virtual ~itkImageProcessor();
|
||||||
@ -167,6 +169,9 @@ private:
|
|||||||
itkImageProcessor(const Self&); //purposely not implemented
|
itkImageProcessor(const Self&); //purposely not implemented
|
||||||
void operator=(const Self&); //purposely not implemented
|
void operator=(const Self&); //purposely not implemented
|
||||||
|
|
||||||
|
/** Fill Meta after 3D volume load */
|
||||||
|
int fill3DVolumeMeta(InternalImageType::Pointer,
|
||||||
|
tPatOrientation);
|
||||||
|
|
||||||
/** Image types */
|
/** Image types */
|
||||||
using ImageType2D = itk::Image<PixelType3D, Dimension>;
|
using ImageType2D = itk::Image<PixelType3D, Dimension>;
|
||||||
|
@ -148,6 +148,8 @@ int vtkContourTopogramProjectionFilter::RequestData(
|
|||||||
pp2[1] -= dProjectionLPSOffset [1];
|
pp2[1] -= dProjectionLPSOffset [1];
|
||||||
pp2[2] -= dProjectionLPSOffset [2];
|
pp2[2] -= dProjectionLPSOffset [2];
|
||||||
|
|
||||||
|
// std::cout << ii << " " << pp2[0] << " " << pp2[1] << " " << pp2[2] << std::endl;
|
||||||
|
|
||||||
PrjPoints->InsertPoint(ii,pp2);
|
PrjPoints->InsertPoint(ii,pp2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user