00001 #ifndef Impala_Core_Test_TestWatershedMarkers_h
00002 #define Impala_Core_Test_TestWatershedMarkers_h
00003
00004 #include "Core/Test/TestImage.h"
00005 #include "Core/Array/WatershedMarkers.h"
00006
00007 namespace Impala
00008 {
00009 namespace Core
00010 {
00011 namespace Test
00012 {
00013
00014
00015 class TestWatershedMarkers : public TestImage
00016 {
00017 public:
00018
00019 TestWatershedMarkers(String srcName, String maskName, int conn, int doLabel)
00020 {
00021 mTestNameBase = "WatershedMarkers";
00022 mSrcName = srcName;
00023 mMaskName = maskName;
00024 mConn = conn;
00025 mDoLabel = doLabel;
00026 }
00027
00028 virtual void
00029 Run()
00030 {
00031 Array2dScalarInt32* src = OpenSrcArrayAsInt(mSrcName);
00032 Array2dScalarInt32* mask = OpenSrcArrayAsInt(mMaskName);
00033 Array2dScalarInt32* res = 0;
00034 WatershedMarkers(res, src, mask, mConn, mDoLabel);
00035
00036 int id = mImSet->GetFileId(mSrcName);
00037 String suffix = FileNameCtor("", mTestNameBase, mMaskName,
00038 mConn, mDoLabel, ".raw");
00039 if (1)
00040 {
00041 Compare(res, mImSet->GetFilePathReference(id, suffix, false, false));
00042 }
00043 else
00044 {
00045 WriteRaw(res, mImSet->GetFilePathReference(id, suffix, true, false),
00046 mImSet->GetDatabase(), true);
00047 }
00048
00049 delete src;
00050 delete mask;
00051 delete res;
00052 }
00053
00054 virtual String
00055 Name() const
00056 {
00057 return FileNameCtor(mTestNameBase, mSrcName, mMaskName, mConn,
00058 mDoLabel, "");
00059 }
00060
00061 private:
00062
00063 String mTestNameBase;
00064 String mSrcName;
00065 String mMaskName;
00066 int mConn;
00067 int mDoLabel;
00068
00069 };
00070
00071
00072 static TestBase* gWatershedMarkersSuite[] =
00073 {
00074 new TestWatershedMarkers("0a.png", "0amask.png", 8, 1),
00075 new TestWatershedMarkers("0a.png", "0amask3.png", 8, 1),
00076 (TestBase*)0
00077 };
00078
00079 }
00080 }
00081 }
00082
00083 #endif