[Insight-users] calculate size of region in mm.

Karthik Krishnan Karthik.Krishnan at kitware.com
Fri Jun 17 09:25:15 EDT 2005


Size in physical units is returned in float. Your code should read

std::vector<float>::const_iterator it;
const std::vector<float> sizeOfObjects =
rcfilter->GetSizeOfObjectsInPhysicalUnits();
it =  sizeOfObjects.begin();
cout<<"size in physical units ="<<*it<<"\n";

instead of what you have below


-kk



yasser salman wrote:

>Hi luis..,
> i'm using connectedthresholed image filter to segment
>the tumor region 
>
>this is the part of calculating the no of pixels:
>
>.
>.
>.
> 
>itk::RelabelComponentImageFilter<SegmentedImageType,SegmentedImageType>
>RelabelImageFilter;
>RelabelImageFilter::Pointer rcfilter=
>RelabelImageFilter::New();
>rcfilter->SetInput(connectedThreshold->GetOutput());  
>rcfilter->Update();
>
>std::vector<unsigned long>::const_iterator it;
>const std::vector<unsigned long> sizeOfObjects =
>rcfilter->GetSizeOfObjectsInPixels();
>it =  sizeOfObjects.begin();
>cout<<"No. of pixels ="<<*it<<"\n";
>
>this code is working good but if i wanna to calculate
>size of region in mm i changed   "sizeOfObjects =
>rcfilter->GetSizeOfObjectsInPixels();" TO 
>sizeOfObjects =
>rcfilter->GetSizeOfObjectsInPhysicalUnits();
>
>The following erroe occured:
>
>"D:\InsightToolkit-1.6.0\Code\BasicFilters\
>itkRelabelComponentImageFilter.h (129): error C2440:
>'return' : cannot convert from 'const class
>std::vector<float,class std::allocator<float> >' to
>'const class std::vector<unsigned long,class
>std::allocator<unsigned long> > &'Reason: cannot
>convert from 'const class std::vector<float,class
>std::allocator<float> >' to 'const class
>std::vector<unsigned long,class
>std::allocator<unsigned long> >'
> No constructor could take the source type, or
>constructor overload resolution was ambiguous 
>D:\InsightToolkit-1.6.0\Code\BasicFilters\itkRelabelComponentImageFilter.h(129)
>: while compiling class-template member function
>'const class std::vector<unsigned long,class
>std::allocator<unsigned long> > &__thiscall
>itk::RelabelComponentIm
>ageFilter<class itk::Image<unsigned short,3>,class
>itk::Image<unsigned short,3>
>  
>
>>::GetSizeOfObjectsInPhysicalUnits(void) const'
>>    
>>
>Error executing cl.exe."
>
>should i change type def of the vector *it* or is
>there any mismathing in the typedef i did it?
>regard's
>yasser
>
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam?  Yahoo! Mail has the best spam protection around 
>http://mail.yahoo.com 
>_______________________________________________
>Insight-users mailing list
>Insight-users at itk.org
>http://www.itk.org/mailman/listinfo/insight-users
>
>  
>


More information about the Insight-users mailing list