Mercurial > hg > orthanc
comparison UnitTestsSources/ImageTests.cpp @ 3837:963ea9fab402
merge
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 15 Apr 2020 17:28:27 +0200 |
parents | 219de90c1f43 |
children |
comparison
equal
deleted
inserted
replaced
3836:0c16051dfd56 | 3837:963ea9fab402 |
---|---|
408 } | 408 } |
409 } | 409 } |
410 } | 410 } |
411 | 411 |
412 { | 412 { |
413 // true means "enforce alignment by using a temporary buffer" | |
414 Orthanc::PamReader r(true); | |
415 r.ReadFromMemory(s); | |
416 | |
417 ASSERT_EQ(r.GetFormat(), Orthanc::PixelFormat_Grayscale16); | |
418 ASSERT_EQ(r.GetWidth(), width); | |
419 ASSERT_EQ(r.GetHeight(), height); | |
420 | |
421 v = 0; | |
422 for (unsigned int y = 0; y < height; y++) | |
423 { | |
424 const uint16_t* p = reinterpret_cast<const uint16_t*> | |
425 ((const uint8_t*)r.GetConstBuffer() + y * r.GetPitch()); | |
426 ASSERT_EQ(p, r.GetConstRow(y)); | |
427 for (unsigned int x = 0; x < width; x++, p++, v++) | |
428 { | |
429 ASSERT_EQ(v, *p); | |
430 } | |
431 } | |
432 } | |
433 | |
434 { | |
413 Orthanc::TemporaryFile tmp; | 435 Orthanc::TemporaryFile tmp; |
414 tmp.Write(s); | 436 tmp.Write(s); |
415 | 437 |
416 Orthanc::PamReader r2; | 438 Orthanc::PamReader r2; |
417 r2.ReadFromFile(tmp.GetPath()); | 439 r2.ReadFromFile(tmp.GetPath()); |
430 { | 452 { |
431 ASSERT_EQ(*p, v); | 453 ASSERT_EQ(*p, v); |
432 } | 454 } |
433 } | 455 } |
434 } | 456 } |
435 } | 457 |
458 { | |
459 Orthanc::TemporaryFile tmp; | |
460 tmp.Write(s); | |
461 | |
462 // true means "enforce alignment by using a temporary buffer" | |
463 Orthanc::PamReader r2(true); | |
464 r2.ReadFromFile(tmp.GetPath()); | |
465 | |
466 ASSERT_EQ(r2.GetFormat(), Orthanc::PixelFormat_Grayscale16); | |
467 ASSERT_EQ(r2.GetWidth(), width); | |
468 ASSERT_EQ(r2.GetHeight(), height); | |
469 | |
470 v = 0; | |
471 for (unsigned int y = 0; y < height; y++) | |
472 { | |
473 const uint16_t* p = reinterpret_cast<const uint16_t*> | |
474 ((const uint8_t*)r2.GetConstBuffer() + y * r2.GetPitch()); | |
475 ASSERT_EQ(p, r2.GetConstRow(y)); | |
476 for (unsigned int x = 0; x < width; x++, p++, v++) | |
477 { | |
478 ASSERT_EQ(*p, v); | |
479 } | |
480 } | |
481 } | |
482 | |
483 } |