| 48 | } |
| 49 | |
| 50 | static IntensityProfile::Pointer ComputeIntensityProfile(Image::Pointer image, itk::PolyLineParametricPath<3>::Pointer path) |
| 51 | { |
| 52 | if (image->GetDimension() == 4) |
| 53 | { |
| 54 | mitkThrow() << "computation of intensity profiles not supported for 4D images"; |
| 55 | } |
| 56 | |
| 57 | IntensityProfile::Pointer intensityProfile = IntensityProfile::New(); |
| 58 | itk::PolyLineParametricPath<3>::InputType input = path->StartOfInput(); |
| 59 | BaseGeometry* imageGeometry = image->GetGeometry(); |
| 60 | const PixelType pixelType = image->GetPixelType(); |
| 61 | |
| 62 | IntensityProfile::MeasurementVectorType measurementVector; |
| 63 | itk::PolyLineParametricPath<3>::OffsetType offset; |
| 64 | Point3D worldPoint; |
| 65 | itk::Index<3> index; |
| 66 | |
| 67 | do |
| 68 | { |
| 69 | imageGeometry->IndexToWorld(path->Evaluate(input), worldPoint); |
| 70 | imageGeometry->WorldToIndex(worldPoint, index); |
| 71 | |
| 72 | mitkPixelTypeMultiplex3(ReadPixel, pixelType, image, index, measurementVector.GetDataPointer()); |
| 73 | intensityProfile->PushBack(measurementVector); |
| 74 | |
| 75 | offset = path->IncrementInput(input); |
| 76 | } while ((offset[0] | offset[1] | offset[2]) != 0); |
| 77 | |
| 78 | return intensityProfile; |
| 79 | } |
| 80 | |
| 81 | template <class TInputImage> |
| 82 | static typename itk::InterpolateImageFunction<TInputImage>::Pointer CreateInterpolateImageFunction(InterpolateImageFunction::Enum interpolator) |
no test coverage detected