7 #include "PlusConfigure.h" 11 #include "vtkObjectFactory.h" 12 #include "vtkXMLDataElement.h" 13 #include "vtkImageReslice.h" 14 #include "vtkImageData.h" 15 #include "vtkAlgorithmOutput.h" 63 this->
ImageReslice->GetInputConnection(0,0)->GetProducer()->UpdateWholeExtent();
64 vtkImageData* inputImage=this->
ImageReslice->GetImageDataInput(0);
67 LOG_ERROR(
"vtkPlusUsScanConvertLinear::Update failed: no input image is specified");
73 int numberOfScanLines=this->InputImageExtent[3]-this->InputImageExtent[2]+1;
76 double inputWidthSpacing=this->
TransducerWidthMm/static_cast<double>(numberOfScanLines);
80 double inputDepthSpacing=this->
ImagingDepthMm/static_cast<double>(scanLineLengthPixels);
83 double zVec[3]={0,0,1.0};
84 this->
ImageReslice->SetResliceAxesDirectionCosines(xVec, yVec, zVec);
87 double halfImageWidthPixel=numberOfScanLines/2*inputWidthSpacing/this->
OutputImageSpacing[0];
88 double transducerCenterPixel[2] = { halfImageWidthPixel, 0};
109 LOG_TRACE(
"vtkPlusUsScanConvertLinear::ReadConfiguration");
116 XML_READ_SCALAR_ATTRIBUTE_OPTIONAL(
double,
ImagingDepthMm, scanConversionElement);
117 XML_READ_SCALAR_ATTRIBUTE_OPTIONAL(
double,
TransducerWidthMm, scanConversionElement);
125 LOG_TRACE(
"vtkPlusUsScanConvertLinear::WriteConfiguration");
132 scanConversionElement->SetDoubleAttribute(
"ImagingDepthMm", this->
ImagingDepthMm);
133 scanConversionElement->SetDoubleAttribute(
"TransducerWidthMm", this->
TransducerWidthMm);
142 if (scanLineIndex<0 || scanLineIndex>=numberOfScanLines)
144 LOG_ERROR(
"GetScanLineEndPoints failed: requestd scanLine="<<scanLineIndex<<
" is out of the valid range (0-"<<numberOfScanLines-1<<
")");
148 int outputImageSizePixel[2]=
151 this->OutputImageExtent[3]-this->OutputImageExtent[2]+1
155 double transducerCenterPixel[2] = { 0.5*outputImageSizePixel[0], 0 };
163 double transducerCornerPixel[2] = { transducerCenterPixel[0]-0.5*imageWidthPixel, transducerCenterPixel[1] };
164 double scanlineSpacingXPixel=imageWidthPixel/double(numberOfScanLines);
165 scanlineStartPoint_OutputImage[0] = transducerCornerPixel[0]+double(scanLineIndex)*scanlineSpacingXPixel;
166 scanlineStartPoint_OutputImage[1] = transducerCornerPixel[1];
167 scanlineStartPoint_OutputImage[2] = 0;
168 scanlineStartPoint_OutputImage[3] = 1;
170 scanlineEndPoint_OutputImage[0] = scanlineStartPoint_OutputImage[0];
172 scanlineEndPoint_OutputImage[2] = 0;
173 scanlineEndPoint_OutputImage[3] = 1;
182 if (scanLineLengthPixels<1)
184 LOG_ERROR(
"Cannot determine DistanceBetweenScanlineSamplePointsMm because scanLineLengthPixels="<<scanLineLengthPixels<<
" is invalid");
187 double distanceBetweenScanlineSamplePointsMm=this->
ImagingDepthMm/double(scanLineLengthPixels);
188 return distanceBetweenScanlineSamplePointsMm;
double TransducerCenterPixel[2]
virtual PlusStatus ReadConfiguration(vtkXMLDataElement *scanConversionElement)
virtual PlusStatus WriteConfiguration(vtkXMLDataElement *scanConversionElement)
vtkImageReslice * ImageReslice
bool TransducerCenterPixelSpecified
virtual void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
virtual PlusStatus WriteConfiguration(vtkXMLDataElement *scanConversionElement)
virtual void SetInputData(vtkDataObject *input)
virtual ~vtkPlusUsScanConvertLinear()
double OutputImageSpacing[3]
vtkPlusUsScanConvertLinear()
virtual double GetDistanceBetweenScanlineSamplePointsMm()
vtkStandardNewMacro(vtkPlusUsScanConvertLinear)
virtual void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
This class performs scan conversion from scan lines for curvilinear probes.
virtual PlusStatus GetScanLineEndPoints(int scanLineIndex, double scanlineStartPoint_OutputImage[4], double scanlineEndPoint_OutputImage[4])
virtual void SetInputConnection(vtkAlgorithmOutput *input)
virtual vtkImageData * GetOutput()
virtual PlusStatus ReadConfiguration(vtkXMLDataElement *scanConversionElement)