#pragma once #include "Common.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "ITKCommand.h" using PixelType = float; using VolumeImageType = itk::Image; using SliceImageType = itk::Image; using ImportFilterType = itk::ImportImageFilter; using SizeType = ImportFilterType::SizeType; using IndexType = ImportFilterType::IndexType; using RegionType = ImportFilterType::RegionType; using OriginType = itk::SpacePrecisionType; using SpacingType = itk::SpacePrecisionType; using Transform3DType = itk::TranslationTransform; using Transform2DType = itk::TranslationTransform; using OutputPixelType = unsigned char; using OutputImageType = itk::Image; const bool ItkOwnTheBuffer = true; class FusionHelper { public: FusionHelper(); ~FusionHelper(); bool LoadBaseVolumeData(UniformVolumeDataInfo baseVolumeInfo); bool FuseWithAnotherVolumeData(UniformVolumeDataInfo anotherVolumeInfo); bool GetFusedVolumeData(UniformVolumeDataInfo& fusedVolumeInfo); private: ImportFilterType::Pointer CreateITKImageFromImportVolumeDatas(UniformVolumeDataInfo volumeInfo, bool flip=false); Transform3DType::ParametersType Get3DTransformationsWithCorrelationMetrics(); Transform2DType::ParametersType Get2DTransformationsWithGradientDifferenceMetric(double translationZ); SliceImageType::Pointer ExtractOneFrame(VolumeImageType::Pointer image,int indexZ); void WriteMhaImage(VolumeImageType::Pointer image, std::string fileName); void WriteBmpImage(SliceImageType* image, std::string fileNmae); VolumeImageType::Pointer Translate3DImage(VolumeImageType::Pointer image,Transform3DType::OutputVectorType translation); ImportFilterType::Pointer ConcatTwoVolumeImageAlongX(VolumeImageType::Pointer oneImage, bool flipOneImage, VolumeImageType::Pointer anotherImage,bool flipAnotherImage); VolumeImageType::Pointer _fixedImage; VolumeImageType::Pointer _movingImage; ImportFilterType::Pointer _fixedImageImpporter; ImportFilterType::Pointer _movingImageImporter; float _spacing; ColorType _colorType; const std::string _outputFolderName = "Outputs"; };