[vtkusers] vtkThreshold

VT dream_vst at yahoo.com
Tue Oct 21 14:41:18 EDT 2003


Hi,

 

I am new to VTK. I am working on image segmentation. I am reading a 16 bit CT data of 512x512 resolution, number of slices 280. I am trying to get all the pixels which lie inside the  isosurface generated for bone. For that I am trying vtkThreshold.  

Part of my code is

************************************************************************************

    vtkVolume16Reader *v16 = vtkVolume16Reader::New();

    v16->SetHeaderSize(1266);

    v16->SetDataDimensions (512,512);

    v16->SetImageRange (45, 45);                      ( trying for just one slice)

    v16->SetDataByteOrderToLittleEndian();

    v16->SetFilePrefix ("xxxxxxxx");

    v16->SetDataSpacing (0.48828125, 0.48828125, 1.5);

    v16->Update();

 

    vtkThreshold *clip = vtkThreshold::New();

    clip->SetInput(v16->GetOutput());

    clip->ThresholdByUpper(1200);

    clip->AllScalarsOff();

    clip->Update();

            

            

    vtkUnstructuredGrid *grid = vtkUnstructuredGrid::New();

    grid = clip->GetOutput();

 

            

    vtkIntArray *array = vtkIntArray::New();

    array = grid->GetCellLocationsArray();

    

    for (i=0; i<array->GetNumberOfTuples(); i++)

    {

                        location= array->GetValue(i);

                        printf("\t %d", location);

    }

************************************************************************************

 

but I am not getting the desired results….  I have attached the images along with the mail. I will really grateful if you can suggest me some solution…

 

Thanks

VT





---------------------------------
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20031021/900a1515/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.JPG
Type: image/pjpeg
Size: 20611 bytes
Desc: image.JPG
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20031021/900a1515/attachment.bin>


More information about the vtkusers mailing list