Load CT (3D) volume from database
* If database contains a CT, that can be imported. * Full pipeline from DataView to itkImageProcessor. * No checks on CT selection in DataView. * No feedback of data loaded from RegistrationView to DataView.
This commit is contained in:
@ -369,6 +369,82 @@ void itkImageProcessor::SetCustom_2Dsize(int nX1, int nY1,int nX2,int nY2)
|
||||
//TODO UPDATE TO FOLLOW
|
||||
}
|
||||
|
||||
int itkImageProcessor::load3DSerieFromFiles( std::vector<std::string> v_fnames){
|
||||
|
||||
|
||||
tPatOrientation m_PatOrientation
|
||||
= tPatOrientation::NotDefined;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
using ImageIOType = itk::GDCMImageIO;
|
||||
ImageIOType::Pointer dicomIO = ImageIOType::New();
|
||||
ImageSeriesReaderType3D::Pointer
|
||||
imageSeriesReader3D = ImageSeriesReaderType3D::New();
|
||||
|
||||
imageSeriesReader3D->SetImageIO(dicomIO);
|
||||
imageSeriesReader3D->SetFileNames(v_fnames);
|
||||
imageSeriesReader3D->SetNumberOfWorkUnits(8);
|
||||
imageSeriesReader3D->ForceOrthogonalDirectionOff(); // properly read CTs with gantry tilt
|
||||
|
||||
imageSeriesReader3D->Update();
|
||||
|
||||
if(v_fnames.size()>0){
|
||||
|
||||
gdcm::Reader R;
|
||||
R.SetFileName(v_fnames.at(0).c_str());
|
||||
if(!R.Read())
|
||||
{
|
||||
cerr<<"ERROR: cannot read file: "<<v_fnames.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::load3DSerie(const char * pcDirName)
|
||||
{
|
||||
@ -493,9 +569,17 @@ int itkImageProcessor::load3DSerie(const char * pcDirName)
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
InternalImageType::Pointer m_InputImage =
|
||||
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){
|
||||
@ -597,9 +681,9 @@ int itkImageProcessor::load3DSerie(const char * pcDirName)
|
||||
image3DIn =
|
||||
m_3DInputChangeInformationToZero->GetOutput();
|
||||
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
|
||||
}
|
||||
|
||||
const std::vector <double> itkImageProcessor::GetRTImportOffset()
|
||||
|
@ -73,6 +73,8 @@ public:
|
||||
|
||||
/** Input data load methods*/
|
||||
int load3DSerie(const char* );
|
||||
int load3DSerieFromFiles( std::vector<std::string> );
|
||||
|
||||
int load2D(const char *);
|
||||
|
||||
void loadRTPlanInfo(double, double, double, double, double ,double);
|
||||
@ -167,6 +169,9 @@ private:
|
||||
itkImageProcessor(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 */
|
||||
using ImageType2D = itk::Image<PixelType3D, Dimension>;
|
||||
|
Reference in New Issue
Block a user