コード例 #1
0
ファイル: dispV.py プロジェクト: 151706061/Slicer3
def dispV0(dataD, inputVolume, shpV):
    scene = slicer.MRMLScene

    r1 = slicer.vtkMRMLScalarVolumeNode()
    r11 = slicer.vtkMRMLScalarVolumeDisplayNode()
    scene.AddNode(r11)

    r1.AddAndObserveDisplayNodeID(r11.GetName())


    imgD = slicer.vtkImageData()
    imgD.SetDimensions(shpV[0], shpV[1], shpV[2])
    imgD.SetScalarTypeToShort()

    org = inputVolume.GetOrigin()
    spa = inputVolume.GetSpacing()

    mat = slicer.vtkMatrix4x4()
    inputVolume.GetIJKToRASMatrix(mat)

    r1.SetAndObserveImageData(imgD)
    r1.SetIJKToRASMatrix(mat)
    r1.SetOrigin(org[0], org[1], org[2])
    r1.SetSpacing(spa[0], spa[1], spa[2])

    scene.AddNode(r1)

    tmp = r1.GetImageData().ToArray()
    tmp[:] = dataD[:] 

    r1.GetDisplayNode().SetDefaultColorMap()
    r1.Modified()

    return
コード例 #2
0
ファイル: dispV.py プロジェクト: 151706061/Slicer3
def dispUV(dataD, org, spa, mat, shpV):
    scene = slicer.MRMLScene

    r1 = slicer.vtkMRMLScalarVolumeNode()
    r11 = slicer.vtkMRMLScalarVolumeDisplayNode()
    scene.AddNode(r11)

    r1.AddAndObserveDisplayNodeID(r11.GetName())


    imgD = slicer.vtkImageData()
    imgD.SetDimensions(shpV[0], shpV[1], shpV[2])
    imgD.SetScalarTypeToUnsignedShort()


    r1.SetAndObserveImageData(imgD)
    r1.SetIJKToRASMatrix(mat)
    r1.SetOrigin(org[0], org[1], org[2])
    r1.SetSpacing(spa[0], spa[1], spa[2])

    scene.AddNode(r1)

    tmp = r1.GetImageData().ToArray()
    print 'tmp   : ', tmp.shape
    print 'dataD : ', dataD.shape
    tmp[:] = dataD[:] 

    r1.GetDisplayNode().SetDefaultColorMap()
    r1.Modified()

    return
コード例 #3
0
def dispV0(dataD, inputVolume, shpV):
    scene = slicer.MRMLScene

    r1 = slicer.vtkMRMLScalarVolumeNode()
    r11 = slicer.vtkMRMLScalarVolumeDisplayNode()
    scene.AddNode(r11)

    r1.AddAndObserveDisplayNodeID(r11.GetName())

    imgD = slicer.vtkImageData()
    imgD.SetDimensions(shpV[0], shpV[1], shpV[2])
    imgD.SetScalarTypeToShort()

    org = inputVolume.GetOrigin()
    spa = inputVolume.GetSpacing()

    mat = slicer.vtkMatrix4x4()
    inputVolume.GetIJKToRASMatrix(mat)

    r1.SetAndObserveImageData(imgD)
    r1.SetIJKToRASMatrix(mat)
    r1.SetOrigin(org[0], org[1], org[2])
    r1.SetSpacing(spa[0], spa[1], spa[2])

    scene.AddNode(r1)

    tmp = r1.GetImageData().ToArray()
    tmp[:] = dataD[:]

    r1.GetDisplayNode().SetDefaultColorMap()
    r1.Modified()

    return
コード例 #4
0
ファイル: dispV.py プロジェクト: Surfndez/Slicer4
def dispUV(dataD, org, spa, mat, shpV):
    scene = slicer.MRMLScene

    r1 = slicer.vtkMRMLScalarVolumeNode()
    r11 = slicer.vtkMRMLScalarVolumeDisplayNode()
    scene.AddNode(r11)

    r1.AddAndObserveDisplayNodeID(r11.GetName())

    imgD = slicer.vtkImageData()
    imgD.SetDimensions(shpV[0], shpV[1], shpV[2])
    imgD.SetScalarTypeToUnsignedShort()

    r1.SetAndObserveImageData(imgD)
    r1.SetIJKToRASMatrix(mat)
    r1.SetOrigin(org[0], org[1], org[2])
    r1.SetSpacing(spa[0], spa[1], spa[2])

    scene.AddNode(r1)

    tmp = r1.GetImageData().ToArray()
    print 'tmp   : ', tmp.shape
    print 'dataD : ', dataD.shape
    tmp[:] = dataD[:]

    r1.GetDisplayNode().SetDefaultColorMap()
    r1.Modified()

    return
コード例 #5
0
ファイル: dispV.py プロジェクト: 151706061/Slicer3
def dispS(dataD, inputVolume, shpV):
    scene = slicer.MRMLScene

    r1 = slicer.vtkMRMLScalarVolumeNode()
    r11 = slicer.vtkMRMLScalarVolumeDisplayNode()
    r11.ScalarVisibilityOn()
    r11.SetScalarRange(dataD.min(), dataD.max())
    scene.AddNode(r11)

    r1.AddAndObserveDisplayNodeID(r11.GetName())

    imgD = slicer.vtkImageData()
    imgD.SetDimensions(shpV[0], shpV[1], shpV[2])
    imgD.SetNumberOfScalarComponents(1)
    imgD.SetScalarTypeToDouble()
    imgD.AllocateScalars()

    org = inputVolume.GetOrigin()
    spa = inputVolume.GetSpacing()

    mat = slicer.vtkMatrix4x4()
    inputVolume.GetIJKToRASMatrix(mat)

    r1.SetAndObserveImageData(imgD)
    r1.SetIJKToRASMatrix(mat)
    r1.SetOrigin(org[0], org[1], org[2])
    r1.SetSpacing(spa[0], spa[1], spa[2])

    scene.AddNode(r1)

    tmp = r1.GetImageData().GetPointData().GetScalars().ToArray()
    print 'tmp   : ', tmp.shape
    print 'dataD : ', dataD.shape
    dataD = reshape(dataD, (shpV[0]*shpV[1]*shpV[2], 1))
    tmp[:] = dataD[:]

    r1.GetDisplayNode().SetDefaultColorMap()
    r1.Modified()

    return
コード例 #6
0
ファイル: dispV.py プロジェクト: Surfndez/Slicer4
def dispS(dataD, inputVolume, shpV):
    scene = slicer.MRMLScene

    r1 = slicer.vtkMRMLScalarVolumeNode()
    r11 = slicer.vtkMRMLScalarVolumeDisplayNode()
    r11.ScalarVisibilityOn()
    r11.SetScalarRange(dataD.min(), dataD.max())
    scene.AddNode(r11)

    r1.AddAndObserveDisplayNodeID(r11.GetName())

    imgD = slicer.vtkImageData()
    imgD.SetDimensions(shpV[0], shpV[1], shpV[2])
    imgD.SetNumberOfScalarComponents(1)
    imgD.SetScalarTypeToDouble()
    imgD.AllocateScalars()

    org = inputVolume.GetOrigin()
    spa = inputVolume.GetSpacing()

    mat = slicer.vtkMatrix4x4()
    inputVolume.GetIJKToRASMatrix(mat)

    r1.SetAndObserveImageData(imgD)
    r1.SetIJKToRASMatrix(mat)
    r1.SetOrigin(org[0], org[1], org[2])
    r1.SetSpacing(spa[0], spa[1], spa[2])

    scene.AddNode(r1)

    tmp = r1.GetImageData().GetPointData().GetScalars().ToArray()
    print 'tmp   : ', tmp.shape
    print 'dataD : ', dataD.shape
    dataD = reshape(dataD, (shpV[0] * shpV[1] * shpV[2], 1))
    tmp[:] = dataD[:]

    r1.GetDisplayNode().SetDefaultColorMap()
    r1.Modified()

    return