X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=tools%2FclitkImageStatisticsGenericFilter.txx;h=b3eff93ce1082304554c03f1a71589a41d2fa059;hb=de83970b84cb6117feb0904c7dd96ea16f755e76;hp=5d462407437554b29aa753d6fffce21c2f5d5c39;hpb=1fb2899e9bf563670147c36ce7e4034dc1d86221;p=clitk.git diff --git a/tools/clitkImageStatisticsGenericFilter.txx b/tools/clitkImageStatisticsGenericFilter.txx index 5d46240..b3eff93 100644 --- a/tools/clitkImageStatisticsGenericFilter.txx +++ b/tools/clitkImageStatisticsGenericFilter.txx @@ -156,7 +156,7 @@ namespace clitk } else { - std::cerr << "Mask image has a different size/spacing than input. Abort" << std::endl; + std::cerr << "Mask image has a different size/spacing than input. Abort. (Use option to resize)" << std::endl; exit(-1); } } @@ -166,9 +166,11 @@ namespace clitk } else { labelImage=LabelImageType::New(); + labelImage->SetDirection(input->GetDirection()); labelImage->SetRegions(input->GetLargestPossibleRegion()); labelImage->SetOrigin(input->GetOrigin()); labelImage->SetSpacing(input->GetSpacing()); + labelImage->SetDirection(input->GetDirection()); labelImage->Allocate(); labelImage->FillBuffer(m_ArgsInfo.label_arg[0]); } @@ -212,7 +214,7 @@ namespace clitk std::cout<GetMaximum(label)<GetSum(label)<GetCount(label)*spacing_cc<GetBoundingBox(label).size(); i++) std::cout<GetBoundingBox(label)[i]<<" "; @@ -276,12 +280,14 @@ namespace clitk if(m_ArgsInfo.dvhistogram_given) { typename StatisticsImageFilterType::HistogramPointer dvhistogram = statisticsFilter->GetHistogram(label); + double totalVolumeCC = ((statisticsFilter->GetCount(label))*spacing_cc); + double totalVolume = statisticsFilter->GetCount(label); // Screen std::cout<<"# Total volume : "; - std::cout<GetCount(label)<<" [No. of voxels]"<GetCount(label))*spacing_cc)<<" [cc]"<GetMean(label)<<" [Gy]"<GetMaximum(label)<<" [Gy]"<GetFrequency(j)); } - double cumulativeVolume = popCumulativeVolume + (dvhistogram->GetFrequency(i)); + double cumulativeVolume = (totalVolume - (popCumulativeVolume + (dvhistogram->GetFrequency(i)))); double percentCumulativeVolume =(cumulativeVolume*100)/(statisticsFilter->GetCount(label)) ; - double ccCumulativeVolume = (popCumulativeVolume + (dvhistogram->GetFrequency(i)))*spacing_cc; + double ccCumulativeVolume = (totalVolumeCC -((popCumulativeVolume + (dvhistogram->GetFrequency(i)))*spacing_cc)); double percentDiffVolume = dvhistogram->GetFrequency(i)*100/(statisticsFilter->GetCount(label)); - if(i == 0) - { - std::cout<GetBinMax(0,i)<<"\t "<GetFrequency(i)<<"\t "<GetFrequency(i))*spacing_cc)<<"\t "<GetBinMax(0,i)<<"\t "<GetFrequency(i)<<"\t "<GetFrequency(i))*spacing_cc)<<"\t "<GetBinMin(0,m_ArgsInfo.bins_arg-i)<<"\t "<GetBinMax(0,i)<<"\t "<GetFrequency(i)<<"\t "<GetFrequency(i))*spacing_cc)<<"\t "<<"\t "<GetCount(label)<<" [No. of voxels]"<GetCount(label))*spacing_cc)<<" [cc]"<GetMean(label)<<" [Gy]"<GetMaximum(label)<<" [Gy]"<GetFrequency(j)); } - double cumulativeVolume = popCumulativeVolume + (dvhistogram->GetFrequency(i)); - double percentCumulativeVolume =(cumulativeVolume*100)/(statisticsFilter->GetCount(label)) ; - double ccCumulativeVolume = (popCumulativeVolume + (dvhistogram->GetFrequency(i)))*spacing_cc; + double cumulativeVolume = (totalVolume - (popCumulativeVolume + (dvhistogram->GetFrequency(i)))); + double percentCumulativeVolume =(cumulativeVolume*100)/(statisticsFilter->GetCount(label)); + double ccCumulativeVolume = (totalVolumeCC -((popCumulativeVolume + (dvhistogram->GetFrequency(i)))*spacing_cc)); double percentDiffVolume = ((dvhistogram->GetFrequency(i))*100)/(statisticsFilter->GetCount(label)); - if(i == 0) - { - dvhistogramFile<GetBinMax(0,i)<<"\t "<GetFrequency(i)<<"\t "<GetFrequency(i))*spacing_cc)<<"\t "<GetBinMax(0,i)<<"\t "<GetFrequency(i)<<"\t "<GetFrequency(i))*spacing_cc)<<"\t "<GetBinMin(0,m_ArgsInfo.bins_arg-i)<<"\t "<GetBinMax(0,i)<<"\t "<GetFrequency(i)<<"\t "<GetFrequency(i))*spacing_cc)<<"\t "<