[ITK-users] Extract slice from ResampleFilter

sidharta sidharta.gupta93 at gmail.com
Thu Apr 6 08:34:14 EDT 2017


Dear all, 

I am trying to extract density profile along a trajectory in CT. Using some
adjustments to contour-based segmentation and getting a mesh from the binary
mask, I computed certain trajectories tangential to certain faces/vertices
of the mesh. 

Now, I have the coordinates of the target point and a tangent to the target.
So, depending on the spacing, I extract all the points along the tangent
which are 5mm away from the target. I am using following code to generate
densities after I have got the physical coordinates along this line. 

void generateDensities(std::vector<Vector3d> points,
InternalImageType::Pointer image){

	InternalImageType::IndexType pixelIndex;
	PointType point;
	itk::ContinuousIndex<double, Dimension> pixel;	
	linearInterpolationContinuousIndexType::Pointer interpolate =
linearInterpolationContinuousIndexType::New();

	interpolate->SetInputImage(image);

	std::vector<int> HU_values;
	std::vector<double> HU_values_interpolate;
	std::vector<InternalImageType::IndexType> Pixel_indices;
	std::vector<itk::ContinuousIndex<double, Dimension>>
Pixel_indices_interpolated;
	// std::cout << "Generating with interpolation" << std::endl;
	for (int i = 0; i < points.size(); i++)
	{
		Vector3d temp_point = points.at(i);
		point[0] = temp_point[0];
		point[1] = temp_point[1];
		point[2] = temp_point[2];
		// std::cout << "Getting continuous index " << std::endl;
		bool isInside = image->TransformPhysicalPointToContinuousIndex(point,
pixel);
		if (isInside)
		{
			InternalImageType::PixelType pixelValue =
interpolate->EvaluateAtContinuousIndex(pixel);
			HU_values_interpolate.push_back(pixelValue);
			Pixel_indices_interpolated.push_back(pixel);
		}
		else
			std::cout << "Point " << point << " with index " << pixel << "is outside"
<< std::endl;
	}
	All_HU_values_interpolated.push_back(HU_values_interpolate);
	All_pixel_indices_interpolated.push_back(Pixel_indices_interpolated);
	HU_values_interpolate.clear();
	HU_values.clear();
}

Now, for verification that I am actually getting in fact the correct values,
I would like to extract the oblique slice along this trajectory and I figure
I have to use the Resample filter to "transform" the CT so that rotation
puts the resampled CT coordinate system parallel to the trajectory and the
origin translated to the start of the trajectory. Now, along the trajectory,
with the set of collinear points (along the trajectory), I can get a lot of
planes (oblique slices essentially) which have the trajectory in them. So to
get around this, I figure if I give another point which is non-collinear to
these points, I can specify the exact oblique slice I want. However, this is
something I have to figure out for a lot of trajectories for the same CT and
then correspondingly for others. Can someone tell me how can I achieve this
"automatically" for all trajectories/CTs? 
PS. All CTs have the same spacing and origin. 
Kindly also mention if you think the function for generating the densities
is correct or not? Eitherways I would like to validate. 

Thank you,
Sidharta




--
View this message in context: http://itk-users.7.n7.nabble.com/Extract-slice-from-ResampleFilter-tp38074.html
Sent from the ITK - Users mailing list archive at Nabble.com.


More information about the Insight-users mailing list