<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
Hi david!<BR>
i make a apology that i did't explain the question on reslice clearer to you last time, and want to ask some question in another way as follows.<BR>
1. i wonder if the data which is resliced is associated with DataSpacing? <BR>
2. SetInterpolationModeToLinear is executed when relice the data?<BR>
3. according to below program in which i add the extraction of data of sagittal based on Imagereslicing.cxx, why size of the data of sagittal is 64*93 but size of the displayed image seems be 64*3.2*93*1.5?<BR>
<BR>
thanks very much!<BR>
<BR>
////////////////////////////////////////////////////////// Set the slice oobliquerientation//////////////////////////////////////////////////// <BR> vtkMatrix4x4 *resliceAxesSagittal = vtkMatrix4x4::New();<BR> resliceAxesSagittal->DeepCopy(sagittalElements);<BR> // Extract a slice in the desired orientation<BR> vtkImageReslice *resliceSagittal = vtkImageReslice::New();<BR> resliceSagittal->SetInputConnection(v16->GetOutputPort());<BR> resliceSagittal->SetOutputDimensionality(2);<BR> resliceSagittal->SetResliceAxes(resliceAxesSagittal);<BR> resliceSagittal->InterpolateOn();<BR> //resliceSagittal->SetInterpolationModeToLinear();<BR> resliceSagittal->Update();<BR> ////////////////////////////////////////extract the data of sagittal////////////////////////////////////////////////////////<BR>
unsigned short *ptrdb=(unsigned short *)resliceSagittal->GetOutput()->GetScalarPointer();<BR> memcpy(sagittalData,ptrdb,64*93*sizeof(unsigned short));<BR><BR> <BR>
<HR id=stopSpelling>
<BR>
From: juanxiaoyan@hotmail.com<BR>To: vtkusers@vtk.org<BR>Date: Thu, 28 Oct 2010 09:34:35 +0800<BR>Subject: [vtkusers] FW: some questions about example Imagereslicing.cxx<BR> <BR>> From: david.gobbi@gmail.com<BR>> Date: Wed, 27 Oct 2010 10:41:16 -0600<BR>> Subject: Re: [vtkusers] some questions about example Imagereslicing.cxx<BR>> To: juanxiaoyan@hotmail.com<BR>> CC: vtkusers@vtk.org<BR>> <BR>> 2010/10/26 晓彦 隽晓彦 <juanxiaoyan@hotmail.com>:<BR>> > i find the value of SetDataSpacing is not used when read the 2D CT images<BR>> > using vtkImageReader2, but i want to read 2D CT images as 3D according to<BR>> > value of SetDataSpacing in order to extract a interpolated slice in desired<BR>> > orientation. i wonder it can be implemented? i will appreciate any answer<BR>> > from you. thank you.<BR>> ><BR>> > some program of the example is as follows:<BR>> > vtkImageReader2 *reader = vtkImageReader2::New();<BR>> > reader->SetFilePrefix(argv[1]);<BR>> > reader->SetDataExtent(0, 63, 0, 63, 1, 93);<BR>> > reader->SetDataSpacing(3.2, 3.2, 1.5);<BR>> > r eader->SetDataOrigin(0.0, 0.0, 0.0);<BR>> > reader->SetDataScalarTypeToUnsignedShort();<BR>> > reader->UpdateWholeExtent();<BR>> <BR>> The image reader cannot do any reslicing. The SetDataSpacing() method<BR>> tells VTK that the pixels in the file are 3.2mm by 3.2mm and that the<BR>> slices are 1.5mm apart, because VTK needs this information in order to<BR>> correctly render the data. To reslice the data, you must add a<BR>> vtkImageReslice filter or a vtkImageResample filter after the reader.<BR>> <BR>> I might have misunderstood your question, but I hope that my answer is helpful.<BR>> <BR>> David<BR> <BR>thanks David! <BR>Because i want to get the resliced data extracted using vtkImageReslice in order to write the display program by myself. so i have another questions.<BR> <BR>1) VTK don't needs SetDataSpacing() method before rendering the data, so do the image reader method? <BR>2) According to the below program, if 1) is true, i can understand why the size of the data of sagittalData is 64×93 instead of 64×3.2×93×1.5. and it is the true that the sagittalData is extracted from CT images directly without considering the DataSpacing , but it is clear that extracted reslice is bad, because the CT images are not interpolated according to the value of SetDataSpacing().<BR> <BR>////////////////////////////////////////////////////////// Set the slice oobliquerientation//////////////////////////////////////////////////// <BR> vtkMatrix4x4 *resliceAxesSagittal = vtkMatrix4x4::New();<BR> resliceAxesSagittal->DeepCopy(sagittalElements);<BR> // Extract a slice in the desired orientation<BR> vtkImageReslice *resliceSagittal = vtkImageReslice::New();<BR> resliceSagittal->SetInputConnection(v16->GetOutputPort());<BR> resliceSagittal->SetOutputDimensionality(2);<BR> resliceSagittal->SetResliceAxes(resliceAxesSagittal);<BR> resliceSagittal->InterpolateOn();<BR> //resliceSagittal->SetInterpolationModeToLinear();<BR> resliceSagittal->Update();<BR> ////////////////////////////////////////extract the data of sagittal////////////////////////////////////////////////////////<BR> if(resliceSagittal->GetOutput()->GetScalarPointer()==NULL){<BR> &nbs p; resliceSagittal->GetOutput()->AllocateScalars();<BR> }<BR> unsigned short *ptrdb=(unsigned short *)resliceSagittal->GetOutput()->GetScalarPointer();<BR> memcpy(sagittalData,ptrdb,64*93*sizeof(unsigned short));<BR><BR><BR>_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ Follow this link to subscribe/unsubscribe: http://www.vtk.org/mailman/listinfo/vtkusers<BR> </body>
</html>