61template <
typename TImage,
typename TInterpolator>
64 typename TInterpolator::Pointer interpolator,
65 const std::vector<float> & voxelSize,
66 const std::function<
typename TImage::PointType(
const typename TImage::PointType &)> & transformPoint);
77template <
typename TImage,
typename TFeatureImage>
78typename TFeatureImage::Pointer
79TensorToImage(
typename TImage::ConstPointer image, torch::Tensor layers);
98template <
typename TImage,
typename FeaturesMaps,
typename InterpolatorType,
typename FeaturesImageType>
99std::vector<FeaturesMaps>
101 typename TImage::ConstPointer image,
102 typename InterpolatorType::Pointer interpolator,
103 const std::vector<itk::ImpactModelConfiguration> & modelsConfiguration,
104 torch::Device device,
105 std::vector<unsigned int> pca,
106 std::vector<torch::Tensor> & principalComponents,
107 const std::function<
void(
typename TImage::ConstPointer, torch::Tensor &,
const std::string &)> & writeInputImage,
108 const std::function<
typename TImage::PointType(
const typename TImage::PointType &)> & transformPoint =
nullptr);
123std::vector<torch::Tensor>
125 const std::string & modelType,
126 torch::Device device);
140std::vector<std::vector<float>>
142 std::mt19937 & randomGenerator,
143 unsigned int dimension);
145template <
typename ImagePo
intType>
147 torch::Tensor(
const ImagePointType &,
const std::vector<std::vector<float>> &,
const std::vector<int64_t> &)>;
164template <
class ImagePo
intType>
165std::vector<torch::Tensor>
167 const std::vector<ImagePointType> & fixedPoints,
168 const std::vector<std::vector<std::vector<std::vector<float>>>> & patchIndex,
169 const std::vector<torch::Tensor> subsetsOfFeatures,
170 torch::Device device,
173template <
typename ImagePo
intType>
176 const std::vector<std::vector<float>> &,
177 const std::vector<int64_t> &,
197template <
typename ImagePo
intType>
198std::vector<torch::Tensor>
200 const std::vector<ImagePointType> & fixedPoints,
201 const std::vector<std::vector<std::vector<std::vector<float>>>> & patchIndex,
202 std::vector<torch::Tensor> subsetsOfFeatures,
203 std::vector<torch::Tensor> fixedOutputsTensor,
204 torch::Device device,
205 std::vector<std::unique_ptr<ImpactLoss::Loss>> & losses,
207 imagesPatchValuesAndJacobiansEvaluator);
std::vector< torch::Tensor > GetModelOutputsExample(std::vector< itk::ImpactModelConfiguration > &modelsConfig, const std::string &modelType, torch::Device device)
Tests the configuration of each model by generating outputs from dummy input.
TFeatureImage::Pointer TensorToImage(typename TImage::ConstPointer image, torch::Tensor layers)
Converts a tensor (C×D×H×W) to a multi-channel ITK image. Converts the given tensor to an ITK image,...
torch::Tensor ImageToTensor(typename TImage::ConstPointer image, typename TInterpolator::Pointer interpolator, const std::vector< float > &voxelSize, const std::function< typename TImage::PointType(const typename TImage::PointType &)> &transformPoint)
Converts an ITK image to a Torch tensor using physical spacing.
std::vector< FeaturesMaps > GetFeaturesMaps(typename TImage::ConstPointer image, typename InterpolatorType::Pointer interpolator, const std::vector< itk::ImpactModelConfiguration > &modelsConfiguration, torch::Device device, std::vector< unsigned int > pca, std::vector< torch::Tensor > &principalComponents, const std::function< void(typename TImage::ConstPointer, torch::Tensor &, const std::string &)> &writeInputImage, const std::function< typename TImage::PointType(const typename TImage::PointType &)> &transformPoint=nullptr)
Applies one or more models to an image to extract feature maps.
std::vector< torch::Tensor > GenerateOutputs(const std::vector< itk::ImpactModelConfiguration > &modelConfig, const std::vector< ImagePointType > &fixedPoints, const std::vector< std::vector< std::vector< std::vector< float > > > > &patchIndex, const std::vector< torch::Tensor > subsetsOfFeatures, torch::Device device, const ImpactTensorUtils::ImagesPatchValuesEvaluator< ImagePointType > &imagesPatchValuesEvaluator)
Computes feature outputs for all patches using each model.
std::vector< torch::Tensor > GenerateOutputsAndJacobian(const std::vector< itk::ImpactModelConfiguration > &modelConfig, const std::vector< ImagePointType > &fixedPoints, const std::vector< std::vector< std::vector< std::vector< float > > > > &patchIndex, std::vector< torch::Tensor > subsetsOfFeatures, std::vector< torch::Tensor > fixedOutputsTensor, torch::Device device, std::vector< std::unique_ptr< ImpactLoss::Loss > > &losses, const ImpactTensorUtils::ImagesPatchValuesAndJacobiansEvaluator< ImagePointType > &imagesPatchValuesAndJacobiansEvaluator)
Computes feature outputs and their spatial Jacobians for image registration.
std::vector< std::vector< float > > GetPatchIndex(const itk::ImpactModelConfiguration &modelConfiguration, std::mt19937 &randomGenerator, unsigned int dimension)
Computes patch index offsets around a center point based on model configuration.