Skip to content

Commit 1474112

Browse files
committed
get bitmaps working
1 parent 8256451 commit 1474112

File tree

11 files changed

+3949
-40
lines changed

11 files changed

+3949
-40
lines changed

src/base/DICe.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,7 @@ enum Image_File_Type{
573573
PNG,
574574
NETCDF,
575575
CINE,
576+
BMP,
576577
MAX_IMAGE_FILE_TYPE,
577578
NO_SUCH_IMAGE_FILE_TYPE
578579
};

src/utils/src/DICe_ImageIO.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ Image_File_Type image_file_type(const char * file_name){
147147
const std::string jpeg("jpeg");
148148
if(file_str.find(jpg)!=std::string::npos||file_str.find(jpeg)!=std::string::npos)
149149
return JPEG;
150+
const std::string bmp("bmp");
151+
if(file_str.find(bmp)!=std::string::npos)
152+
return BMP;
150153
const std::string png("png");
151154
if(file_str.find(png)!=std::string::npos)
152155
return PNG;

tests/component/DICe_TestImage.cpp

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,6 @@ int main(int argc, char *argv[]) {
442442
}
443443
*outStream << "hierarchical image filter has been checked" << std::endl;
444444

445-
bool exception_thrown = false;
446-
447445
// create an image from jpeg file:
448446
*outStream << "creating an image from a jpeg file " << std::endl;
449447
Teuchos::RCP<Image> img_jpg = Teuchos::rcp(new Image("./images/ImageB.jpg"));
@@ -489,19 +487,6 @@ int main(int argc, char *argv[]) {
489487
*outStream << "Error, the jpeg sub image does not have the right intensities." << std::endl;
490488
errorFlag++;
491489
}
492-
// // test that unsupported file formats throw an exception
493-
// exception_thrown = false;
494-
// try{
495-
// DICe::Image jpg("./images/invalid.jpg");
496-
// }
497-
// catch (const std::exception &e){
498-
// exception_thrown = true;
499-
// *outStream << ".jpg throws an exception as expected" << std::endl;
500-
// }
501-
// if(!exception_thrown){
502-
// *outStream << "Error, an exception should have been thrown for unsupported .jpg file format, but was not" << std::endl;
503-
// errorFlag++;
504-
// }
505490
// create an image from jpeg file:
506491
*outStream << "creating an image from a png file " << std::endl;
507492
Teuchos::RCP<Image> img_png = Teuchos::rcp(new Image("./images/ImageB.png"));
@@ -547,31 +532,6 @@ int main(int argc, char *argv[]) {
547532
*outStream << "Error, the png sub image does not have the right intensities." << std::endl;
548533
errorFlag++;
549534
}
550-
// // test that unsupported file formats throw an exception
551-
// exception_thrown = false;
552-
// try{
553-
// DICe::Image png("./images/invalid.png");
554-
// }
555-
// catch (const std::exception &e){
556-
// exception_thrown = true;
557-
// *outStream << ".png throws an exception as expected" << std::endl;
558-
// }
559-
// if(!exception_thrown){
560-
// *outStream << "Error, an exception should have been thrown for invalid .png file format, but was not" << std::endl;
561-
// errorFlag++;
562-
// }
563-
// test that unsupported file formats throw an exception
564-
try{
565-
DICe::Image bmp("./images/invalid.bmp");
566-
}
567-
catch (const std::exception &e){
568-
exception_thrown = true;
569-
*outStream << ".bmp throws an exception as expected" << std::endl;
570-
}
571-
if(!exception_thrown){
572-
*outStream << "Error, an exception should have been thrown for invalid .bmp file format, but was not" << std::endl;
573-
errorFlag++;
574-
}
575535

576536
*outStream << "--- End test ---" << std::endl;
577537

tests/component/images/invalid.bmp

-10.8 KB
Binary file not shown.

tests/component/images/invalid.png

-8.02 KB
Binary file not shown.

tests/regression/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ SET(REGRESSION_TESTS
1111
conformal_subset_def
1212
dic_challenge_12
1313
dic_challenge_12_sorted
14+
bitmap_star
1415
)
1516

1617
IF(NOT DICE_USE_DOUBLE)

tests/regression/bitmap_star/gold/DICe_solution_0.txt

Lines changed: 3901 additions & 0 deletions
Large diffs are not rendered by default.
Binary file not shown.
Binary file not shown.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!-- Auto generated input file from DICe GUI -->
2+
<ParameterList>
3+
<Parameter name="output_folder" type="string" value="./results/" />
4+
<Parameter name="correlation_parameters_file" type="string" value="params.xml" />
5+
<Parameter name="subset_size" type="int" value="31" />
6+
<Parameter name="step_size" type="int" value="15" />
7+
<Parameter name="separate_output_file_for_each_subset" type="bool" value="false" />
8+
<Parameter name="create_separate_run_info_file" type="bool" value="true" />
9+
<Parameter name="image_folder" type="string" value="" />
10+
<Parameter name="reference_image" type="string" value="./images/DIC_Challenge_Wave_Deformed_Noisy.bmp" />
11+
<ParameterList name="deformed_images">
12+
<Parameter name="./images/DIC_Challenge_Wave_Reference_Noisy.bmp" type="bool" value="true" />
13+
</ParameterList>
14+
</ParameterList>

0 commit comments

Comments
 (0)