15 typedef itk::Image<unsigned char, 3> LabelImage;
17 if (collection->HasElement(origin))
19 LabelImage::Pointer originImage =
dynamic_cast<LabelImage*
>(collection->GetData(origin).GetPointer());
21 if (!collection->HasElement(target) && originImage.IsNotNull())
25 image->SetRegions(originImage->GetLargestPossibleRegion());
26 image->SetSpacing(originImage->GetSpacing());
27 image->SetOrigin(originImage->GetOrigin());
28 image->SetDirection(originImage->GetDirection());
31 collection->AddData(dynamic_cast<itk::DataObject*>(image.GetPointer()),target,
"");
34 for (std::size_t i = 0; i < collection->Size();++i)
47 typedef itk::Image<unsigned char, 3> LabelImage;
49 if (collection->HasElement(origin))
51 LabelImage::Pointer originImage =
dynamic_cast<LabelImage*
>(collection->GetData(origin).GetPointer());
53 if (!collection->HasElement(target) && originImage.IsNotNull())
57 image->SetRegions(originImage->GetLargestPossibleRegion());
58 image->SetSpacing(originImage->GetSpacing());
59 image->SetOrigin(originImage->GetOrigin());
60 image->SetDirection(originImage->GetDirection());
63 collection->AddData(dynamic_cast<itk::DataObject*>(image.GetPointer()),target,
"");
66 for (std::size_t i = 0; i < collection->Size();++i)
78 m_Collection = collection;
92 std::vector<DataCollectionImageIterator<double, 3> > iterProbA;
93 std::vector<DataCollectionImageIterator<double, 3> > iterProbB;
94 for (
int i = 0; i < m_ProbabilityClassA.size(); ++i)
97 iterProbA.push_back(iter);
99 for (
int i = 0; i < m_ProbabilityClassB.size(); ++i)
102 iterProbB.push_back(iter);
114 for (
int i = 0; i < iterProbA.size(); ++i)
116 probA += iterProbA[i].GetVoxel();
118 for (
int i = 0; i < iterProbB.size(); ++i)
120 probB += iterProbB[i].GetVoxel();
134 for (
int i = 0; i < iterProbA.size(); ++i)
138 for (
int i = 0; i < iterProbB.size(); ++i)
159 iterLabel.
SetVoxel(probA >= threshold ? 1 : 2);
178 for (
double threshold = 0 ; threshold <= 100; threshold += stepSize)
180 CalculateClass(threshold);
182 std::stringstream ss;
183 ss << shortLabel <<
";" << threshold;
193 stat.
Print(out, sout,
false, ss.str());
itk::Image< mitk::ScalarType, 3 > FeatureImage
itk::SmartPointer< Self > Pointer
DataCollection::Pointer GetCollection()
void Print(std::ostream &out, std::ostream &sout=std::cout, bool withHeader=false, std::string label="None")
bool CalculateClass(double threshold)
void SetTestName(std::string name)
void SetVoxel(TDataType value)
void SetMaskName(std::string name)
void SetGoldName(std::string name)
static void EnsureDataImageInCollection(mitk::DataCollection::Pointer collection, std::string origin, std::string target)
void SetCollection(DataCollection::Pointer collection)
void SetClassCount(vcl_size_t count)
static void EnsureLabelImageInCollection(mitk::DataCollection::Pointer collection, std::string origin, std::string target)
void SetCollection(DataCollection::Pointer collection)
bool WriteStatistic(std::ostream &out, std::ostream &sout, double stepSize, std::string shortLabel)
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.