ITK过滤器错误:"输入不占用相同的物理空间"在仿射登记后

时间:2018-05-25 16:26:15

标签: itk

我试图对两张MRI图像进行微变形恶魔登记。到目前为止,处理流程一直是这样的:

  1. 颅骨剥离
  2. 各向异性扩散(平滑)
  3. 直方图匹配
  4. 仿射注册
  5. Diffeomorphic Demons Registration
  6. 我没有提出这个过程,只是修复并清理了几个研究人员已经建立的切片软件工具。我是一名暑期学生,对领域不太熟悉,但我开始更不了解自己的情况。我在过去几周内无法解决的问题是这个错误:

    itk::ExceptionObject (0x1231130)
    Location: "void itk::ImageToImageFilter<TInputImage, TOutputImage>::VerifyInputInformation() [with TInputImage = itk::Image<itk::Vector<float, 3u>, 3u>; TOutputImage = itk::Image<itk::Vector<float, 3u>, 3u>]" 
    File: /home/parallels/Desktop/Slicer-SuperBuild/ITKv4/Modules/Core/Common/include/itkImageToImageFilter.hxx
    Line: 241
    Description: itk::ERROR: DiffeomorphicDemonsRegistrationFilter(0x13870b0): Inputs do not occupy the same physical space! 
    InputImage Origin: [7.9639916e+01, -1.1042095e+02, -1.0426932e+02], InputImageMovingImage Origin: [-8.8678563e+01, -1.4923204e+02, 1.2193930e+02]
        Tolerance: 1.5000000e-05
    InputImage Spacing: [1.5000000e+01, 1.5000000e+01, 1.9199951e+01], InputImageMovingImage Spacing: [1.5154560e+01, 1.5108180e+01, 1.9319538e+01]
        Tolerance: 1.5000000e-05
    InputImage Direction: 1.5926319e-08 1.4070701e-08 -1.0000000e+00
    9.9237583e-01 -1.2324859e-01 1.4070700e-08
    1.2324859e-01 9.9237583e-01 1.5926320e-08
    , InputImageMovingImage Direction: -0.0000000e+00 5.5205551e-10 1.0000000e+00
    5.5205551e-10 1.0000000e+00 -5.5205553e-10
    -1.0000000e+00 5.5205551e-10 0.0000000e+00
    
        Tolerance: 1.0000000e-06
    

    根据我的理解,微分形式配准依赖于两个图像重合,因此预先进行仿射配准步骤。但是出于某些原因,仿射变换并没有正确地排列这两个图像。结果,他们不会占据相同的物理空间。我显然遗漏了一些东西,但似乎无法弄清楚它是什么。

    使用此file执行仿射注册(我在本地副本上进行了一些编辑,以符合切片器模块的输入/输出方式,但它们几乎完全相同)。创建的转换具有以下特征:

    Optimizer stop condition: RegularStepGradientDescentOptimizerv4: Step too small after 33 iterations. Current step (9.76563e-05) is less than minimum step (0.0001).
     Result = 
     Center X      = -1.95155
     Center Y      = 11.6381
     Center Z      = 36.5165
     Translation X = 1.09423
     Translation Y = 0.021133
     Translation Z = -0.0154539
     Iterations    = 34
     Metric value  = 8974.52
     Scale 1         = 1.15384
     Scale 2         = 1.08962
     Angle (degrees) = -5.6116
    

    以下代码用于将转换保存到文件中:

      // Write the transform to a file
      itk::TransformFileWriter::Pointer transformWriter = itk::TransformFileWriter::New();
    
      transformWriter->SetInput( registration->GetOutput()->Get() );
      transformWriter->SetFileName( outputMatrix.c_str() );
      transformWriter->Update();
    

    使用此file执行恶魔注册(进行了一些编辑,但大部分都是相同的)。仿射变换在第799行加载。

    Reading transform from transform input file.
    Found: AffineTransform (0x1e0c0b0)
      RTTI typeinfo:   itk::AffineTransform<double, 3u>
      Reference Count: 3
      Modified Time: 1322
      Debug: Off
      Object Name: 
      Observers: 
        none
      Matrix: 
        1.01338 0.0887047 0.0223631 
        -0.11891 1.09423 0.021133 
        -0.0154539 0.0302253 1.14062 
      Offset: [-0.256888, -34.7809, -17.895]
      Center: [-1.95155, 11.6381, 36.5165]
      Translation: [1.56597, -32.6804, -12.3781]
      Inverse: 
        0.977286 -0.0787352 -0.0177019 
        0.105999 0.905809 -0.0188607 
        0.0104321 -0.0250698 0.876975 
      Singular: 0
    

    编辑:注释掉以下行不会更改结果输出中的任何内容。即根本没有应用初始位移。仍然不知道为什么。

    typedef typename itk::MultiResolutionPDEDeformableRegistration <ImageType, ImageType, DeformationFieldType, PixelType >   MultiResRegistrationFilterType;
    typename MultiResRegistrationFilterType::Pointer multires = MultiResRegistrationFilterType::New();
    
    // Commenting out this line doesn't change anything
    multires->SetArbitraryInitialDisplacementField ( inputDefField );
    

1 个答案:

答案 0 :(得分:0)

您使用的Diffeomorphic Demons Registration代码似乎要求FixedMoving图片具有相同的物理空间,这意味着:

  • 来源
  • 间距
  • 尺寸

您是否尝试resample moving image fixed image空格,然后使用此Diffeomorphic Demons Registrationresampled moving image致电fixed image

我不知道这个EZminc代码,但看起来它需要两个输入以某种方式在同一个空间中。