123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #pragma once
- #include "Common.h"
- #include <io.h>
- #include <direct.h>
- #include <itkImage.h>
- #include <itkImportImageFilter.h>
- #include <itkTranslationTransform.h>
- #include <itkRegularStepGradientDescentOptimizerv4.h>
- #include <itkCorrelationImageToImageMetricv4.h>
- #include <itkGradientDifferenceImageToImageMetric.h>
- #include <itkImageRegistrationMethodv4.h>
- #include <itkImageRegistrationMethod.h>
- #include <itkMetaImageIO.h>
- #include <itkImageFileWriter.h>
- #include <itkExtractImageFilter.h>
- #include <itkRescaleIntensityImageFilter.h>
- #include <itkBMPImageIO.h>
- #include <itkFlipImageFilter.h>
- #include <itkDiscreteGaussianImageFilter.h>
- #include <itkRegionOfInterestImageFilter.h>
- #include "ITKCommand.h"
- using PixelType = float;
- using VolumeImageType = itk::Image<PixelType, 3>;
- using SliceImageType = itk::Image<PixelType, 2>;
- using ImportFilterType = itk::ImportImageFilter<PixelType, 3>;
- using SizeType = ImportFilterType::SizeType;
- using IndexType = ImportFilterType::IndexType;
- using RegionType = ImportFilterType::RegionType;
- using OriginType = itk::SpacePrecisionType;
- using SpacingType = itk::SpacePrecisionType;
- using Transform3DType = itk::TranslationTransform<double, 3>;
- using Transform2DType = itk::TranslationTransform<double, 2>;
- using OutputPixelType = unsigned char;
- using OutputImageType = itk::Image<OutputPixelType, 3>;
- 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";
- };
|