[vtkusers] probe volume with thick line ( intensity profile with line radius or thickness )
gregthom992
gregthom992 at gmail.com
Sun Feb 4 00:16:53 EST 2018
Hi David,
So I am almost there but there is some magic you have to explain to me. Is
there some graphics that explans how imagereslice works ?
For instance:
How do you know to do
reslice.SetOutputExtent(0, N, 0, 0, 0, 0) # this gives one line of output
and not
reslice.SetOutputExtent(0, 0, 0, 0, 0, N) # this gives one line of output
Both give one line of output but I am lost here.
Also:
Please I know I can get multiple lines for instance 2 lines by:
reslice.SetOutputExtent(0, N, 0, 1, 0, 0) # this gives two lines of output
What were you saying about fiddling with origin ? Below is my complete code
which doesn't give me the expected results
===================
vtkimage = SITKtoVTK(itkimage)
vtkimage.SetOrigin(itkimage.GetOrigin())
print itkimage
print vtkimage
p0 = np.array(prf_start)
p1 = np.array(prf_stop)
vv = p1 - p0
nn = vv/np.linalg.norm(vv, 1)
u, w = vtkMathPerpendiculars(nn, 3*[0], 3*[0], 0)
#print vtkimage, itkimage
print vv
print nn
print u, ' ', w
#
oM2 = vtk.vtkMatrix4x4()
oM2.DeepCopy((
nn[0], u[0], w[0], p0[0],
nn[1], u[1], w[1], p0[1],
nn[2], u[2], w[2], p0[2],
0, 0, 0, 1 ))
print oM2
#
reslice = vtk.vtkImageReslice()
reslice.SetInput(vtkimage)
#reslice.SetOutputOrigin(itkimage.GetOrigin()[0],
itkimage.GetOrigin()[1], itkimage.GetOrigin()[2])
reslice.SetOutputOrigin(0, 0, 0)
reslice.SetOutputSpacing(itkimage.GetSpacing()[0],
itkimage.GetSpacing()[1], itkimage.GetSpacing()[2])
if prf_params[0] in ['depth']:
reslice.SetOutputExtent(0, itkimage.GetDepth()-1, 0, 0, 0,
0) # this gives one line of output
if prf_params[0] in ['inline']:
reslice.SetOutputExtent(0, 0, 0, itkimage.GetHeight()-1, 0,
0) # this gives one line of output
if prf_params[0] in ['crossline']:
reslice.SetOutputExtent(0, 0, 0, 0, 0,
itkimage.GetWidth()-1) # this gives one line of output
reslice.SetInterpolationModeToLinear()
reslice.SetResliceAxes(oM2)
reslice.Update()
vtkimage2 = reslice.GetOutput()
print vtkimage2
numpy_data =
numpy_support.vtk_to_numpy(vtkimage2.GetPointData().GetScalars())
print numpy_data
===== SAMPLE OUTPUT ====
reading mhd complete ...
bounds : [-148.5 148.5 -148.5 148.5 -99.5 99.5]
center_pixel: (50, 50, 100)
center_coord: [ 0. 0. 0.]
imsage size : [100, 100, 200]
profile type: depth | start=[0.0, 0.0, -99.5] stop=[0.0, 0.0, 99.5]
profile type: depth | start_pixel=(50, 50, 0) stop_pixel=(50, 50, 199)
Image (13AF3398)
RTTI typeinfo: class itk::Image<float,3>
Reference Count: 1
Modified Time: 964
Debug: Off
Object Name:
Observers:
none
Source: (none)
Source output name: (none)
Release Data: Off
Data Released: False
Global Release Data: Off
PipelineMTime: 939
UpdateMTime: 963
RealTimeStamp: 0 seconds
LargestPossibleRegion:
Dimension: 3
Index: [0, 0, 0]
Size: [100, 100, 200]
BufferedRegion:
Dimension: 3
Index: [0, 0, 0]
Size: [100, 100, 200]
RequestedRegion:
Dimension: 3
Index: [0, 0, 0]
Size: [100, 100, 200]
Spacing: [3, 3, 1]
Origin: [-148.5, -148.5, -99.5]
Direction:
1 0 0
0 1 0
0 0 1
IndexToPointMatrix:
3 0 0
0 3 0
0 0 1
PointToIndexMatrix:
0.333333 0 0
0 0.333333 0
0 0 1
Inverse Direction:
1 0 0
0 1 0
0 0 1
PixelContainer:
ImportImageContainer (01E13E20)
RTTI typeinfo: class itk::ImportImageContainer<unsigned long,float>
Reference Count: 1
Modified Time: 960
Debug: Off
Object Name:
Observers:
none
Pointer: 19020020
Container manages memory: true
Size: 2000000
Capacity: 2000000
vtkImageData (13C95EF0)
Debug: Off
Modified Time: 309
Reference Count: 3
Registered Events: (none)
Source: (none)
Information: 139DB158
Data Released: False
Global Release Data: Off
UpdateTime: 0
Release Data: Off
UpdateExtent: Not Initialized
RequestExactExtent: Off
Field Data:
Debug: Off
Modified Time: 291
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Number Of Points: 2000000
Number Of Cells: 1950399
Cell Data:
Debug: Off
Modified Time: 284
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Copy Tuple Flags: ( 1 1 1 1 1 0 1 1 )
Interpolate Flags: ( 1 1 1 1 1 0 0 1 )
Pass Through Flags: ( 1 1 1 1 1 1 1 1 )
Scalars: (none)
Vectors: (none)
Normals: (none)
TCoords: (none)
Tensors: (none)
GlobalIds: (none)
PedigreeIds: (none)
EdgeFlag: (none)
Point Data:
Debug: Off
Modified Time: 290
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 1
Array 0 name = scalars
Number Of Components: 1
Number Of Tuples: 2000000
Copy Tuple Flags: ( 1 1 1 1 1 0 1 1 )
Interpolate Flags: ( 1 1 1 1 1 0 0 1 )
Pass Through Flags: ( 1 1 1 1 1 1 1 1 )
Scalars:
Debug: Off
Modified Time: 289
Reference Count: 1
Registered Events: (none)
Name: scalars
Data type: float
Size: 2000000
MaxId: 1999999
NumberOfComponents: 1
Information: 00000000
Name: scalars
Number Of Components: 1
Number Of Tuples: 2000000
Size: 2000000
MaxId: 1999999
LookupTable: (none)
Array: 1D690020
Vectors: (none)
Normals: (none)
TCoords: (none)
Tensors: (none)
GlobalIds: (none)
PedigreeIds: (none)
EdgeFlag: (none)
Bounds:
Xmin,Xmax: (-148.5, 148.5)
Ymin,Ymax: (-148.5, 148.5)
Zmin,Zmax: (-99.5, 99.5)
Compute Time: 0
ScalarType: 10
NumberOfScalarComponents: 1
Spacing: (3, 3, 1)
Origin: (-148.5, -148.5, -99.5)
Dimensions: (100, 100, 200)
Increments: (0, 0, 0)
Extent: (0, 99, 0, 99, 0, 199)
[ 0. 0. 199.]
[ 0. 0. 1.]
[0, -1.0, 0.0] [1.0, -0.0, -0.0]
vtkMatrix4x4 (08E30D38)
Debug: Off
Modified Time: 312
Reference Count: 1
Registered Events: (none)
Elements:
0 0 1 0
0 -1 -0 0
1 0 -0 -99.5
0 0 0 1
vtkImageData (13C95B78)
Debug: Off
Modified Time: 625
Reference Count: 2
Registered Events: (none)
Source: (none)
Information: 139DAF50
Data Released: False
Global Release Data: Off
UpdateTime: 626
Release Data: Off
UpdateExtent: Not Initialized
UpdateExtent: 0, 199, 0, 0, 0, 0
CombinedUpdateExtent: 0, -1, 0, -1, 0, -1
WholeExtent: 0, 199, 0, 0, 0, 0
ExtentTranslator: (08B2C528)
RequestExactExtent: Off
Field Data:
Debug: Off
Modified Time: 594
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Number Of Points: 200
Number Of Cells: 199
Cell Data:
Debug: Off
Modified Time: 602
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Copy Tuple Flags: ( 1 1 1 1 1 0 1 1 )
Interpolate Flags: ( 1 1 1 1 1 0 0 1 )
Pass Through Flags: ( 1 1 1 1 1 1 1 1 )
Scalars: (none)
Vectors: (none)
Normals: (none)
TCoords: (none)
Tensors: (none)
GlobalIds: (none)
PedigreeIds: (none)
EdgeFlag: (none)
Point Data:
Debug: Off
Modified Time: 625
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 1
Array 0 name = ImageScalars
Number Of Components: 1
Number Of Tuples: 200
Copy Tuple Flags: ( 1 1 1 1 1 0 1 1 )
Interpolate Flags: ( 1 1 1 1 1 0 0 1 )
Pass Through Flags: ( 1 1 1 1 1 1 1 1 )
Scalars:
Debug: Off
Modified Time: 622
Reference Count: 1
Registered Events: (none)
Name: ImageScalars
Data type: float
Size: 200
MaxId: 199
NumberOfComponents: 1
Information: 00000000
Name: ImageScalars
Number Of Components: 1
Number Of Tuples: 200
Size: 200
MaxId: 199
LookupTable: (none)
Array: 1BD7EEA8
Vectors: (none)
Normals: (none)
TCoords: (none)
Tensors: (none)
GlobalIds: (none)
PedigreeIds: (none)
EdgeFlag: (none)
Bounds:
Xmin,Xmax: (0, 597)
Ymin,Ymax: (0, 0)
Zmin,Zmax: (0, 0)
Compute Time: 0
ScalarType: 10
NumberOfScalarComponents: 1
Spacing: (3, 3, 1)
Origin: (0, 0, 0)
Dimensions: (200, 1, 1)
Increments: (0, 0, 0)
Extent: (0, 199, 0, 0, 0, 0)
[ 2.69376324e-06 2.98764326e-06 3.12571501e-06 3.19816422e-06
3.08941594e-06 3.24563098e-06 3.36744961e-06 3.50718847e-06
3.41049872e-06 3.64814764e-06 3.61693901e-06 3.50275968e-06
3.54628014e-06 3.59668115e-06 3.76970297e-06 3.72300451e-06
3.86106831e-06 3.93086566e-06 4.09007953e-06 4.26286624e-06
4.21147206e-06 4.39374435e-06 4.24289055e-06 4.35135053e-06
4.50011703e-06 4.59888543e-06 4.58769182e-06 4.56170801e-06
4.86139834e-06 5.40174142e-06 6.13106795e-06 7.46469141e-06
9.48133766e-06 1.24298458e-05 1.71255706e-05 2.26814991e-05
2.83051340e-05 3.53847463e-05 4.19322168e-05 4.81512252e-05
5.48132775e-05 5.96905338e-05 6.66187989e-05 7.01088939e-05
7.38430535e-05 7.55145375e-05 7.73844367e-05 8.04474184e-05
8.26143078e-05 8.35268438e-05 8.50798824e-05 8.57990308e-05
8.60243017e-05 8.66826304e-05 8.76013291e-05 8.80208900e-05
8.73666650e-05 8.81852466e-05 8.91573800e-05 8.96064594e-05
8.93770411e-05 8.99249790e-05 8.91938034e-05 8.84891706e-05
8.82743698e-05 8.73582539e-05 8.30601784e-05 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
More information about the vtkusers
mailing list