<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 This notebook illustrates the TubeTK tube NumPy array data structure and how to create histograms of the properties of a VesselTube.
First, import the function for reading a tube file in as a NumPy array, and read in the file.
Step1:  The result is a NumPy Record Array where the fields of the array correspond to the properties of a VesselTubeSpatialObjectPoint.
Step2:  The length of the array corresponds to the number of points that make up the tubes.
Step3:  Individual points can be sliced, or views can be created on individual fields.
Step4:  We can easily create a histogram of the radii or visualize the point positions.
<ASSISTANT_TASK:>
Python Code:
import os
import sys
from itk import tubes_from_file
tubes = tubes_from_file("data/Normal071-VascularNetwork.tre")
Explanation: This notebook illustrates the TubeTK tube NumPy array data structure and how to create histograms of the properties of a VesselTube.
First, import the function for reading a tube file in as a NumPy array, and read in the file.
End of explanation
print(type(tubes))
print(tubes.dtype)
Explanation: The result is a NumPy Record Array where the fields of the array correspond to the properties of a VesselTubeSpatialObjectPoint.
End of explanation
print(len(tubes))
print(tubes.shape)
Explanation: The length of the array corresponds to the number of points that make up the tubes.
End of explanation
print('Entire points 0, 2:')
print(tubes[:4:2])
print('\nPosition of points 0, 2')
print(tubes['PositionInWorldSpace'][:4:2])
Explanation: Individual points can be sliced, or views can be created on individual fields.
End of explanation
%pylab inline
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(16, 6))
ax = fig.add_subplot(1, 2, 1)
ax.hist(tubes['RadiusInWorldSpace'], bins=100)
ax.set_xlabel('Radius')
ax.set_ylabel('Count')
ax = fig.add_subplot(1, 2, 2, projection='3d')
subsample = 100
position = tubes['PositionInWorldSpace'][::subsample]
radius = tubes['RadiusInWorldSpace'][::subsample]
ax.scatter(position[:,0], position[:,1], position[:,2], s=(2*radius)**2)
ax.set_title('Point Positions')
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z');
Explanation: We can easily create a histogram of the radii or visualize the point positions.
End of explanation
<END_TASK>