X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestWriteSimple.cxx;h=19b216bc1e901c5a116bcfcd7584bb821cda2da5;hb=e51bf0565bbe4c0e269dd941cb4071ebde6012e4;hp=42f710a32e6e0b70d77a7e86ce482c1cc5df1b7f;hpb=361dbdfcc3c04b3b30d427c1c09d962d5c9cefb3;p=gdcm.git diff --git a/Testing/TestWriteSimple.cxx b/Testing/TestWriteSimple.cxx index 42f710a3..19b216bc 100644 --- a/Testing/TestWriteSimple.cxx +++ b/Testing/TestWriteSimple.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestWriteSimple.cxx,v $ Language: C++ - Date: $Date: 2005/02/05 03:12:28 $ - Version: $Revision: 1.19 $ + Date: $Date: 2005/02/10 14:23:18 $ + Version: $Revision: 1.25 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -63,7 +63,40 @@ Image Images [] = { {256, 512, 1, 1, 16, 16, 0, 'a'}, {256, 512, 1, 1, 16, 16, 0, 'e'}, {256, 512, 1, 1, 16, 16, 0, 'i'}, - {0, 0, 1, 1, 8, 8, 0, 'i'} // to find the end + + {512, 256, 10, 1, 8, 8, 0, 'a'}, + {512, 256, 10, 1, 8, 8, 0, 'e'}, + {512, 256, 10, 1, 8, 8, 0, 'i'}, + {512, 256, 10, 3, 8, 8, 0, 'a'}, + {512, 256, 10, 3, 8, 8, 0, 'e'}, + {512, 256, 10, 3, 8, 8, 0, 'i'}, + + {256, 256, 1, 1, 8, 8, 1, 'a'}, + {256, 256, 1, 1, 8, 8, 1, 'e'}, + {256, 256, 1, 1, 8, 8, 1, 'i'}, + + {512, 256, 1, 1, 8, 8, 1, 'a'}, + {512, 256, 1, 1, 8, 8, 1, 'e'}, + {512, 256, 1, 1, 8, 8, 1, 'i'}, + + {256, 512, 1, 1, 8, 8, 1, 'a'}, + {256, 512, 1, 1, 8, 8, 1, 'e'}, + {256, 512, 1, 1, 8, 8, 1, 'i'}, + + {256, 512, 1, 1, 16, 16, 1, 'a'}, + {256, 512, 1, 1, 16, 16, 1, 'e'}, + {256, 512, 1, 1, 16, 16, 1, 'i'}, + {256, 512, 1, 1, 16, 16, 1, 'a'}, + {256, 512, 1, 1, 16, 16, 1, 'e'}, + {256, 512, 1, 1, 16, 16, 1, 'i'}, + + {512, 256, 10, 1, 8, 8, 1, 'a'}, + {512, 256, 10, 1, 8, 8, 1, 'e'}, + {512, 256, 10, 1, 8, 8, 1, 'i'}, + {512, 256, 10, 3, 8, 8, 1, 'a'}, + {512, 256, 10, 3, 8, 8, 1, 'e'}, + {512, 256, 10, 3, 8, 8, 1, 'i'}, + {0, 0, 1, 1, 8, 8, 0, 'i'} // to find the end }; int WriteSimple(Image &img) @@ -96,18 +129,6 @@ int WriteSimple(Image &img) str << img.componentSize; fileToBuild->InsertValEntry(str.str(),0x0028,0x0100); // Bits Allocated - /******************************************/ - /******************************************/ - // Super duper kludge !! - if( img.componentSize == 16 ) - { - // I guess by design user should know that... - fileToBuild->InsertBinEntry(0,0, 0x7fe0, 0x0010, "OW"); - } - /******************************************/ - /******************************************/ - - str.str(""); str << img.componentUse; fileToBuild->InsertValEntry(str.str(),0x0028,0x0101); // Bits Stored @@ -145,7 +166,7 @@ int WriteSimple(Image &img) * img.components * img.componentSize / 8; unsigned char *imageData = new unsigned char[size]; - // FIXME : find a best heuristic to create the image + // FIXME : find a better heuristic to create the image unsigned char *tmp = imageData; for(int k=0;kGetFile()->IsReadable() ) { - std::cerr << "Failed" << std::endl - << "Test::TestReadWriteReadCompare: Could not reread image " - << "written:" << fileName << std::endl; - delete fileToBuild; - delete file; - delete reread; - return 1; + std::cerr << "Failed" << std::endl + << "Could not reread image written: " << fileName << std::endl; + delete fileToBuild; + delete file; + delete reread; + delete[] imageData; + return 1; } // Step 6 : Compare to the written image @@ -265,9 +286,8 @@ int WriteSimple(Image &img) } // Test the data's content - if (int res = memcmp(imageData, imageDataWritten, size) !=0) + if ( memcmp(imageData, imageDataWritten, size) !=0 ) { - (void)res; std::cout << "Failed" << std::endl << " Pixel differ (as expanded in memory)." << std::endl; delete fileToBuild;