Skip to content

Commit aca7684

Browse files
committed
add image pyramid build test
1 parent 21365a4 commit aca7684

File tree

2 files changed

+191
-0
lines changed

2 files changed

+191
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#include <QDebug>
2+
3+
#include "../../application/logic/io/ZoomOutLevelImageBuilder.h"
4+
5+
#include <QElapsedTimer> //for basic time spent measurement
6+
7+
int main(int argc, char* agrv[]) {
8+
9+
QString qstrDirRootZLIStorage = "/home/laurent/tmp";
10+
11+
//image with NaN here and there. The more interesting part is in the small white rectangular at middle, bottom.
12+
QString strInputImage = "/home/laurent/inputDataForTests/inputImages/test_PyramidImageBuild_withNan/test_nan5_big.tif";
13+
14+
//image with NaN only at the bottom of a 10Kx10K pixels to check that the level image #4 is correclty rewrote after a first start writing level image #4 with the standard way
15+
//with the Nan count to detect to build differently
16+
//QString strInputImage = "/home/laurent/inputDataForTests/inputImages/test_PyramidImageBuild_withNan/float_withNanAtImageBottomOnly_10Kx10K.tif";
17+
18+
19+
ZoomOutLevelImageBuilder zoliBuilder(strInputImage, qstrDirRootZLIStorage);
20+
21+
bool bReport = zoliBuilder.makeStorageDirectory(0);
22+
if (!bReport) {
23+
return(1);
24+
}
25+
26+
QElapsedTimer timer;
27+
timer.start();
28+
29+
bReport = true;
30+
int stepAmount_untilWidthOrHeightGreaterThan = 0;
31+
int stepAmount_untilWidthOrHeightGreaterThan_usingRootImageForEachLevel = 0;
32+
int stepAmount_untilWidthOrHeightGreaterThan_usingRootImageForEachLevel_startFromZLI4 = 0;
33+
34+
bReport &= zoliBuilder.computeStepAmountForProgressBar_untilWidthOrHeightGreaterThan(
35+
1024, stepAmount_untilWidthOrHeightGreaterThan);
36+
bReport &= zoliBuilder.computeStepAmountForProgressBar_untilWidthOrHeightGreaterThan_usingRootImageForEachLevel(
37+
1024,
38+
stepAmount_untilWidthOrHeightGreaterThan_usingRootImageForEachLevel,
39+
stepAmount_untilWidthOrHeightGreaterThan_usingRootImageForEachLevel_startFromZLI4);
40+
41+
qDebug() << __FUNCTION__ << "stepAmount_untilWidthOrHeightGreaterThan :"
42+
<< stepAmount_untilWidthOrHeightGreaterThan;
43+
44+
qDebug() << __FUNCTION__ << "stepAmount_untilWidthOrHeightGreaterThan_usingRootImageForEachLevel :"
45+
<< stepAmount_untilWidthOrHeightGreaterThan_usingRootImageForEachLevel;
46+
47+
qDebug() << __FUNCTION__ << "stepAmount_untilWidthOrHeightGreaterThan_usingRootImageForEachLevel_startFromZLI4 :"
48+
<< stepAmount_untilWidthOrHeightGreaterThan_usingRootImageForEachLevel_startFromZLI4;
49+
50+
bool bContainsNan = false;
51+
bReport = zoliBuilder.build_untilWidthOrHeightGreaterThan(1024, stepAmount_untilWidthOrHeightGreaterThan, bContainsNan);
52+
if (bContainsNan) {
53+
qDebug() << __FUNCTION__ << "restart from zoomLevel4 handling Nan";
54+
bReport = zoliBuilder.build_untilWidthOrHeightGreaterThan_usingRootImageForEachLevel_fromLevel(
55+
4, 1024, stepAmount_untilWidthOrHeightGreaterThan_usingRootImageForEachLevel_startFromZLI4);
56+
if (!bReport) {
57+
return(1);
58+
}
59+
}
60+
61+
qint64 elapsedTime = timer.elapsed();
62+
qDebug() << __FUNCTION__ << "took :" << elapsedTime << " ms ";
63+
64+
return(0);
65+
}
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
2+
message("Qt version:" $$QT_VERSION)
3+
4+
#versionAtLeast(QT_VERSION, 5.6versionNumber) # introduced in qt 5.10
5+
lessThan(QT_MAJOR_VERSION, 5) {
6+
error("this projet needs Qt version >= Qt 5.12")
7+
}
8+
9+
equals(QT_MAJOR_VERSION, 5) {
10+
lessThan(QT_MINOR_VERSION, 12) {
11+
error("this projet needs Qt version >= Qt 5.12")
12+
}
13+
}
14+
15+
# #TagToFindAboutReleaseDeliveryOption
16+
# RELEASE DELIVERY:
17+
#
18+
#CONFIG += release
19+
#CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
20+
21+
QT += core
22+
23+
QT += concurrent
24+
25+
#greaterThan(QT_MAJOR_VERSION, 4):
26+
QT += widgets
27+
28+
29+
TARGET = test_ZLIImageBuild
30+
TEMPLATE = app
31+
32+
# The following define makes your compiler emit warnings if you use
33+
# any feature of Qt which has been marked as deprecated (the exact warnings
34+
# depend on your compiler). Please consult the documentation of the
35+
# deprecated API in order to know how to port your code away from it.
36+
DEFINES += QT_DEPRECATED_WARNINGS
37+
38+
# You can also make your code fail to compile if you use deprecated APIs.
39+
# In order to do so, uncomment the following line.
40+
# You can also select to disable deprecated APIs only up to a certain version of Qt.
41+
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
42+
43+
!include( ../thirdpartylibs.pri ) {
44+
error( "No ../thirdpartylibs.pri file found" )
45+
}
46+
47+
48+
INCLUDEPATH += $$INPRO__THIRD_PARTY_LIBS_ROOT/oiio-RB-2.1/src/include/
49+
50+
INCLUDEPATH += $$INPRO__THIRD_PARTY_LIBS_ROOT/oiio-RB-2.1/buildhere/include/
51+
52+
INCLUDEPATH += $$INPRO__THIRD_PARTY_LIBS_ROOT/oiio-RB-2.1/ext/fmt/include
53+
54+
55+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/oiio-RB-2.1/buildhere/lib/libOpenImageIO.a
56+
57+
#openexr header installed here:
58+
INCLUDEPATH += "/usr/local/include/"
59+
60+
61+
INCLUDEPATH += $$INPRO__THIRD_PARTY_LIBS_ROOT/openexr-2.4.0/IlmBase/Imath/
62+
INCLUDEPATH += $$INPRO__THIRD_PARTY_LIBS_ROOT/openexr-2.4.0/buildhere/IlmBase/config/ #for IlmBaseConfig.h
63+
INCLUDEPATH += $$INPRO__THIRD_PARTY_LIBS_ROOT/openexr-2.4.0/IlmBase/Iex/ #for IexBaseExc.h
64+
DEPENDPATH += $$INPRO__THIRD_PARTY_LIBS_ROOT/openexr-2.4.0/buildhere/IlmBase/Imath/
65+
66+
LIBS += -lz -ldl
67+
68+
#static lib linking:
69+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/openexr-2.4.0/buildhere/IlmBase/Half/libHalf-2_4.a
70+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/openexr-2.4.0/buildhere/OpenEXR/IlmImfUtil/libIlmImfUtil-2_4.a
71+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/openexr-2.4.0/buildhere/OpenEXR/IlmImf/libIlmImf-2_4.a
72+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/openexr-2.4.0/buildhere/IlmBase/IlmThread/libIlmThread-2_4.a
73+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/openexr-2.4.0/buildhere/IlmBase/Iex/libIex-2_4.a
74+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/openexr-2.4.0/buildhere/IlmBase/Imath/libImath-2_4.a
75+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/openexr-2.4.0/buildhere/IlmBase/IexMath/libIexMath-2_4.a
76+
77+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/boost170installhere/lib/libboost_filesystem.a
78+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/boost170installhere/lib/libboost_system.a
79+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/boost170installhere/lib/libboost_thread.a
80+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/boost170installhere/lib/libboost_chrono.a
81+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/boost170installhere/lib/libboost_date_time.a
82+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/boost170installhere/lib/libboost_atomic.a
83+
84+
LIBS += -lpthread
85+
86+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/libpng-1.6.37/.libs/libpng16.a
87+
88+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/jpeg-8b/.libs/libjpeg.a
89+
90+
LIBS +=-ltiff
91+
92+
LIBS += -lm
93+
94+
CONFIG += c++14
95+
96+
QMAKE_CXXFLAGS += -std=c++14
97+
98+
#for debugging :
99+
#QMAKE_CXXFLAGS += -lefence
100+
101+
INCLUDEPATH += ../../application
102+
INCLUDEPATH += ../../application/logic
103+
104+
SOURCES += \
105+
../../application/logic/io/ZoomOutLevelImageBuilder.cpp \
106+
../../application/logic/vecttype.cpp \
107+
../../application/logic/toolbox/toolbox_pathAndFile.cpp \
108+
../../application/logic/toolbox/toolbox_json.cpp \
109+
../../application/logic/toolbox/toolbox_conversion.cpp \
110+
../../application/logic/io/iojsoninfos.cpp \
111+
../../application/logic/io/InputImageFormatChecker.cpp \
112+
main.cpp
113+
114+
HEADERS += \
115+
../../application/logic/io/ZoomOutLevelImageBuilder.h \
116+
../../application/logic/vecttype.h \
117+
../../application/logic/toolbox/toolbox_pathAndFile.h \
118+
../../application/logic/toolbox/toolbox_json.h \
119+
../../application/logic/toolbox/toolbox_conversion.h \
120+
../../application/logic/io/iojsoninfos.h \
121+
../../application/logic/io/InputImageFormatChecker.h \
122+
123+
# Default rules for deployment.
124+
qnx: target.path = /tmp/$${TARGET}/bin
125+
else: unix:!android: target.path = /opt/$${TARGET}/bin
126+
!isEmpty(target.path): INSTALLS += target

0 commit comments

Comments
 (0)