Fixed bugs:

- Interpolating all available space in DRT geometry.
 - Isocenter visualisation based on same filter as contours
 - Wrting SOP Class and SOP Instance UID in SRO
This commit is contained in:
viar
2022-09-16 16:53:03 +02:00
parent 12d02d8cbc
commit 7717c1fdad
4 changed files with 62 additions and 45 deletions

View File

@ -137,60 +137,62 @@ void DRTImageMetaInformation::SetSizeWithBounds(
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 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.;
// 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]);
// dNPixMin1 = abs(dXmin / Spacing[0]);
// dNPixMin2 = abs(dYmin / Spacing[0]);
// dNPixMax1 = abs(dXmax / Spacing[0]);
// dNPixMax2 = abs(dYmax / Spacing[0]);
double dPixMaxOverlap =dNPixMin1;
// double dPixMaxOverlap =dNPixMin1;
if(dPixMaxOverlap > dNPixMin2){
dPixMaxOverlap = dNPixMin2;
}
// if(dPixMaxOverlap > dNPixMin2){
// dPixMaxOverlap = dNPixMin2;
// }
if(dPixMaxOverlap > dNPixMax1){
dPixMaxOverlap = dNPixMax1;
}
// if(dPixMaxOverlap > dNPixMax1){
// dPixMaxOverlap = dNPixMax1;
// }
if(dPixMaxOverlap > dNPixMax2){
dPixMaxOverlap = dNPixMax2;
}
// if(dPixMaxOverlap > dNPixMax2){
// dPixMaxOverlap = dNPixMax2;
// }
if(floor(dPixMaxOverlap*2) > MaxSize[0]) {
m_Size[0] = MaxSize[0];
} else {
m_Size[0] = floor(dPixMaxOverlap*2);
}
// 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]);
// dNPixMin1 = abs(dZmin / Spacing[1]);
// dNPixMax1 = abs(dZmax / Spacing[1]);
dPixMaxOverlap =dNPixMin1;
if(dPixMaxOverlap > dNPixMax1){
dPixMaxOverlap = dNPixMax1;
}
// 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);
}
// 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[1] = MaxSize[1];
m_Size[2] = 1;
m_Spacing = Spacing;
@ -287,8 +289,7 @@ CTVolumeImageMetaInformation::GetProjectionOriginLPSZero(
PointType Origin;
Origin = this->m_OriginLPS;
// Is this the trick? that cut out images?
// Origin = Origin - this->m_ImportOffset;
Origin = Origin - this->m_ImportOffset;
DirectionType IECtoLPS_Directions;

View File

@ -1462,7 +1462,7 @@ void itkImageProcessor::InitializeProjector()
image3DIn);
resampleFilter1->SetDefaultPixelValue(0);
resampleFilter1->SetNumberOfWorkUnits(12);
resampleFilter1->SetNumberOfWorkUnits(8);
// The parameters of interpolator1, such as ProjectionAngle and FocalPointToIsocenterDistance
// have been set before registration. Here we only need to replace the initial
@ -1481,7 +1481,7 @@ void itkImageProcessor::InitializeProjector()
resampleFilter2->SetInput(
image3DIn);
resampleFilter2->SetDefaultPixelValue(0);
resampleFilter2->SetNumberOfWorkUnits(12);
resampleFilter2->SetNumberOfWorkUnits(8);
// The parameters of interpolator2, such as ProjectionAngle and FocalPointToIsocenterDistance

View File

@ -173,8 +173,21 @@ gSiddonJacobsRayCastInterpolateImageFunction<TInputImage, TCoordRep>::Evaluate(c
regionCT = inputPtr->GetLargestPossibleRegion();
sizeCT = regionCT.GetSize();
// If Pixel position (in mm) is outside bounds of CT (zero-based)
// assign 0 at the pixel and move on. Ensures regular spacing of resulting
// DRR
float xSizeCT = sizeCT[0] * ctPixelSpacing[0];
float ySizeCT = sizeCT[1] * ctPixelSpacing[1];
float zSizeCT = sizeCT[2] * ctPixelSpacing[2];
float xDrrPix = drrPixelWorld[0];float yDrrPix = drrPixelWorld[1];float zDrrPix = drrPixelWorld[2];
// if(zDrrPix < 0 /*|| yDrrPix < 0 || xDrrPix < 0*/)
// std::cout << drrPixelWorld[0]<<" " <<drrPixelWorld[1]<<" "<<drrPixelWorld[2]<<" / ";
if(xDrrPix>xSizeCT || yDrrPix>ySizeCT || zDrrPix>zSizeCT){
pixval = static_cast<OutputType>(0.0);
return pixval;
}
// calculate the detector position for this pixel center by moving
// 2*m_FocalPointToIsocenterDistance from the source in the pixel
// directions

View File

@ -94,6 +94,7 @@ int vtkContourTopogramProjectionFilter::RequestData(
// If no points, then nothing to do.
if (points == nullptr)
{
std::cout << "Cannot Project; no input points" << std::endl;
vtkDebugMacro("Cannot Project; no input points");
return 1;
}
@ -101,6 +102,7 @@ int vtkContourTopogramProjectionFilter::RequestData(
// If reference transform, then nothing to do.
if (m_RefTransform == nullptr)
{
std::cout << "Cannot Project; no input reference projection transform" << std::endl;
vtkDebugMacro("Cannot Project; no input reference projection transform");
return 1;
}
@ -108,6 +110,7 @@ int vtkContourTopogramProjectionFilter::RequestData(
// If transform, then nothing to do.
if (m_Transform == nullptr)
{
std::cout << "Cannot Project; no input projection transform" << std::endl;
vtkDebugMacro("Cannot Project; no input projection transform");
return 1;
}