VTK 生成MIP图像-vtkImageSlabReslice类
MIP
MIP(Maximum/Minimum Intensity Projection),最大/最小密度投影重建。
MIP可以较真实地反应组织密度差异,使得血管的异常改变、形态、走形强化;但是只适用于外观形态的显示。
在容积扫描数据中对每条径线上每个像素的最大强度值进行编码并投射成像。MIP的灰阶度反映CT值的相对大小,且比较敏感,即使小的差异也能被检测,如钙化灶、骨骼CT非常高,充盈对比剂的血管同样很高的CT值,但总是低于钙化灶和骨骼,在MIP图像上,其亮度不一样,可区分。
MIP应用价值(最大密度投影重建)
广泛应用于具有相对高密度的组织和结构,如显影的血管、骨骼、肺部肿块以及明显强化的软组织病灶等,对于密度差异甚小的组织结构以及病灶则难以显示。
最小密度投影重建(MinP)
它是在某一平面方向上对所选取的三维组织层块中的最小密度进行投影,主要用于气道的显示。偶尔也用于肝脏增强后肝内扩张胆管的显示。
多张胸部CT图像生成的MIP;
vtkImageSlabReslice
vtkImageSlabReslice类派生自vtkImageReslice类,在切片的基础上,可以设定Slab的厚度,进行多切面的投影叠加。由于vtkImageReslice类继承自vtkThreadedImageAlgorithm类,内部是多线程的,使用方法SetNumberOfThreads()来设置线程个数。vtkImageSlabReslice类以三维图像为输入,沿某一方向产生一个二维的有一定厚度的MPR。
很像vtkimanageslice,reslice轴方向余弦可以通过SetResliceAxes或SetResliceAxesDirectionCosines方法设置。输出间距由SetOutputSpacing控制,输出原点由SetOutputOrigin控制。重新格式化时,由SetBackgroundColor或SetBackgroundLevel控制的位于Volume外部的像素的默认值。SetResliceAxesOrigin()方法还可以用于提供切片将通过的(x,y,z)点。
注意:vtkGPUVolumeRayCastMapper类也有MIP的体渲染方式,具体使用请看官方文档;
接口
投影方式
vtkImageSlabReslice类使用混合函数获取有厚度的切片图像,支持的混合函数包括穿过板的最小强度混合(VTK_IMAGE_SLAB_MIN)、最大强度混合(VTK_IMAGE_SLAB_MAX)和穿过板的平均(平均)强度值(VTK_IMAGE_SLAB_MEAN)。
板间距
板间距是切片层与切片层之间的距离,是在世界坐标系下的真实距离,单位为mm;
板内层个数NumBlendSamplePoints可以由SlabThickness和SlabResolution计算得到,即(2 x (int)(0.5 x SlabThickness/SlabResolution)) + 1;
板厚
SlabThickness用来记录板的厚度,必须是非0的正数;
1 double SlabThickness; 2 vtkSetMacro(SlabThickness, double); 3 vtkGetMacro(SlabThickness, double);切片层个数
NumBlendSamplePoints是指在板内横截面使用的采样点数。如果NumBlendSamplePoints等于1,就相当是vtkImageReslice,一个薄的Reslic切片;NumBlendSamplePoints可以由SlabThickness和SlabResolution计算得到;
示例
1 #include "vtkMetaImageReader.h" 2 #include "vtkImageData.h" 3 #include "vtkMatrix4x4.h" 4 #include "vtkImageReslice.h" 5 #include "vtkLookupTable.h" 6 #include "vtkImageMapToColors.h" 7 #include "vtkImageActor.h" 8 #include "vtkImageMapper3D.h" 9 #include "vtkRenderer.h" 10 #include "vtkRenderWindoh" 11 #include "vtkRenderWindowInteractor.h" 12 #include "vtkInteractorStyleImage.h" 13 #include "vtkImageSlabReslice.h" 14 #include "vtkAutoInit.h" 15 VTK_MODULE_INIT(vtkRenderingOpenGL2); 16 VTK_MODULE_INIT(vtkInteractionStyle); 17 18 using namespace std; 19 int main() ; 43 44 vtkNew<vtkMatrix4x4> resliceAxes; 45 resliceAxes>DeepCopy(axialElements); 46 resliceAxes>SetElement(0, 3, center[0]); 47 resliceAxes>SetElement(1, 3, center[1]); 48 resliceAxes>SetElement(2, 3, center[2]); 49 50 vtkNew<vtkImageSlabReslice> reslice; 51 reslice>SetInputConnection(reader>GetOutputPort()); 52 reslice>SetOutputDimensionality(2); 53 reslice>SetResliceAxes(resliceAxes); 54 reslice>SetInterpolationModeToLinear(); 55 reslice>SetSlabThickness(200); 56 reslice>SetBlendModeToMax(); 57 reslice>Update(); 58 59 vtkNew<vtkLookupTable> colorTable; 60 colorTable>SetRange(0, 1000); 61 colorTable>SetValueRange(0.0, 1.0); 62 colorTable>SetSaturationRange(0.0, 0.0); colorTable>SetRampToLinear(); 64 colorTable>Build(); 65 66 vtkNew<vtkImageMapToColors> colorMap; 67 colorMap>SetLookupTable(colorTable); 68 colorMap>SetInputConnection(reslice>GetOutputPort()); 69 70 vtkNew<vtkImageActor> imgActor; 71 imgActor>GetMapper()>SetInputConnection(colorMap>GetOutputPort()); 72 73 vtkNew<vtkRenderer> renderer; 74 renderer>AddActor(imgActor); 75 renderer>SetBackground(1.0, 1.0, 1.0); 76 77 vtkNew<vtkRenderWindow> renderWindow; 78 renderWindow>AddRenderer(renderer); 79 renderWindow>Render(); 80 renderWindow>SetSize(640, 480); 81 renderWindow>SetWindowName("ImageResliceExample"); 82 83 vtkNew<vtkRenderWindowInteractor> renderWindowInteractor; 84 vtkNew<vtkInteractorStyleImage> imagestyle; 85 86 renderWindowInteractor>SetInteractorStyle(imagestyle); 87 renderWindowInteractor>SetRenderWindow(renderWindow); 88 renderWindowInteractor>Initialize(); 89 renderWindowInteractor>Start(); 90 return 0; 91 }SetSlabThickness使用2.0的效果;
SetSlabThickness使用20.0的效果;
SetSlabThickness使用200.0的效果;
上一篇:Qt QJsonDocument以及与QJsonArray、QJsonObject、QJsonValue的关联
VTK