[Insight-users] MEAN and VARIANCE
Kevin H. Hobbs
hobbsk at ohiou.edu
Tue Mar 16 06:23:18 EDT 2010
On 03/16/2010 05:57 AM, edoardo.belletti at alice.it wrote:
>
> Hi Insight users
>
> How can I calculate the mean and the variance of a region of my image
> with ITK?
>
> Thank you very much in advance
> Edoardo
>
>
typedef itk::ExtractImageFilter< ImageType, ImageType > ExtractorType;
ExtractorType::Pointer extractor = ExtractorType::New();
extractor->SetExtractionRegion( region );
extractor->SetInput( image );
typedef itk::StatisticsImageFilter< ImageType > StatType;
StatType::Pointer stats = StatType::New();
stats->SetInput( extractor->GetOutput() );
stats->Update();
double mean = stats->GetMean();
double varience = stats->GetVariance();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100316/0b607b76/attachment.pgp>
More information about the Insight-users
mailing list