Commit 963c233f authored by Sebastien Jodogne's avatar Sebastien Jodogne

New upstream version 0.4+dfsg

parent 3c6e241e
repo: 4a7a53257c7df5a97aea39377b8c9a6e815c9763
node: cafc4728a8577cd9f07e4bbff7a638ba577ceb10
branch: OrthancWSI-0.2
node: 84b3128ba48f6f333b4b949794ceac16c3afc820
branch: OrthancWSI-0.4
latesttag: null
latesttagdistance: 76
latesttagdistance: 102
changessincelatesttag: 103
......@@ -6,8 +6,15 @@ Authors
-------
* Sebastien Jodogne <s.jodogne@gmail.com>
Department of Medical Physics
Overall design and lead developer.
* Department of Medical Physics
University Hospital of Liege
4000 Liege
Belgium
Overall design and lead developer.
* Osimis <info@osimis.io>
Rue des Chasseurs Ardennais 3
4031 Liege
Belgium
......@@ -2,6 +2,7 @@
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017 Osimis, Belgium
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
......@@ -24,10 +25,24 @@
#include "../Resources/Orthanc/Core/HttpClient.h"
#include "../Resources/Orthanc/Core/Logging.h"
#include "../Resources/Orthanc/Core/MultiThreading/BagOfTasksProcessor.h"
#include "../Resources/Orthanc/Core/SystemToolbox.h"
#include "../Resources/Orthanc/OrthancServer/FromDcmtkBridge.h"
#include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/regex.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <cassert>
static bool DisplayPerformanceWarning()
{
(void) DisplayPerformanceWarning; // Disable warning about unused function
LOG(WARNING) << "Performance warning in whole-slide imaging: "
<< "Non-release build, runtime debug assertions are turned on";
return true;
}
namespace OrthancWSI
{
......@@ -39,6 +54,7 @@ namespace OrthancWSI
Orthanc::HttpClient::InitializeOpenSsl();
Orthanc::HttpClient::GlobalInitialize();
Orthanc::FromDcmtkBridge::InitializeDictionary(false /* don't load private dictionary */);
assert(DisplayPerformanceWarning());
}
......@@ -184,11 +200,34 @@ namespace OrthancWSI
<< path << " " << ORTHANC_WSI_VERSION << std::endl
<< "Copyright (C) 2012-2016 Sebastien Jodogne, "
<< "Medical Physics Department, University Hospital of Liege (Belgium)" << std::endl
<< "Copyright (C) 2017 Osimis S.A. (Belgium)" << std::endl
<< "Licensing AGPL: GNU AGPL version 3 or later <http://gnu.org/licenses/agpl.html>." << std::endl
<< "This is free software: you are free to change and redistribute it." << std::endl
<< "There is NO WARRANTY, to the extent permitted by law." << std::endl
<< std::endl
<< "Written by Sebastien Jodogne <s.jodogne@gmail.com>" << std::endl;
}
void ShowVersionInLog(const char* path)
{
std::string version(ORTHANC_WSI_VERSION);
if (version == "mainline")
{
try
{
boost::filesystem::path exe(Orthanc::SystemToolbox::GetPathToExecutable());
std::time_t creation = boost::filesystem::last_write_time(exe);
boost::posix_time::ptime converted(boost::posix_time::from_time_t(creation));
version += " (" + boost::posix_time::to_iso_string(converted) + ")";
}
catch (...)
{
}
}
LOG(WARNING) << "Orthanc WSI version: " << version;
}
}
}
......@@ -2,6 +2,7 @@
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017 Osimis, Belgium
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
......@@ -42,5 +43,7 @@ namespace OrthancWSI
const std::string& color);
void PrintVersion(const char* path);
void ShowVersionInLog(const char* path);
}
}
......@@ -78,14 +78,17 @@ include(${ORTHANC_WSI_DIR}/Resources/CMake/OpenJpegConfiguration.cmake)
include(${ORTHANC_WSI_DIR}/Resources/CMake/LibTiffConfiguration.cmake)
add_definitions(
-DORTHANC_BUILD_UNIT_TESTS=0 # For FromDcmtkBridge
-DORTHANC_ENABLE_BASE64=1
-DORTHANC_ENABLE_CURL=1
-DORTHANC_ENABLE_DCMTK=1
-DORTHANC_ENABLE_JPEG=0 # Disable DCMTK's support for JPEG
-DORTHANC_ENABLE_LOGGING=1
-DORTHANC_ENABLE_LOGGING_PLUGIN=0
-DORTHANC_ENABLE_LUA=0 # For FromDcmtkBridge
-DORTHANC_ENABLE_MD5=0
-DORTHANC_ENABLE_JPEG=0 # Disable DCMTK's support for JPEG
-DORTHANC_ENABLE_PKCS11=0
-DORTHANC_ENABLE_PLUGINS=1 # To enable class Orthanc::SharedLibrary
-DORTHANC_ENABLE_PLUGINS=1 # To enable class Orthanc::SharedLibrary
-DORTHANC_ENABLE_PUGIXML=0
-DORTHANC_SANDBOXED=0
-DHAS_ORTHANC_EXCEPTION=1
......
......@@ -2,6 +2,7 @@
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017 Osimis, Belgium
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
......@@ -274,6 +275,7 @@ static void Run(OrthancWSI::ITiledPyramid& source,
int main(int argc, char* argv[])
{
OrthancWSI::ApplicationToolbox::GlobalInitialize();
OrthancWSI::ApplicationToolbox::ShowVersionInLog(argv[0]);
int exitStatus = 0;
boost::program_options::variables_map options;
......
......@@ -2,6 +2,7 @@
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017 Osimis, Belgium
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
......@@ -260,78 +261,93 @@ static void SetupDimension(DcmDataset& dataset,
const OrthancWSI::ITiledPyramid& source,
const OrthancWSI::ImagedVolumeParameters& volume)
{
std::string uid;
// Extract the identifier of the Dimension Organization, if provided
std::string organization;
DcmItem* previous = OrthancWSI::DicomToolbox::ExtractSingleSequenceItem(dataset, DCM_DimensionOrganizationSequence);
if (previous != NULL)
if (previous != NULL &&
previous->tagExists(DCM_DimensionOrganizationUID))
{
const char* tmp = NULL;
if (previous->findAndGetString(DCM_DimensionOrganizationUID, tmp).good() &&
tmp != NULL)
organization = OrthancWSI::DicomToolbox::GetStringTag(*previous, DCM_DimensionOrganizationUID);
}
else
{
// No Dimension Organization provided: Generate an unique identifier
organization = Orthanc::FromDcmtkBridge::GenerateUniqueIdentifier(Orthanc::ResourceType_Instance);
}
{
// Construct tag "Dimension Organization Sequence" (0020,9221)
std::auto_ptr<DcmItem> item(new DcmItem);
OrthancWSI::DicomToolbox::SetStringTag(*item, DCM_DimensionOrganizationUID, organization);
std::auto_ptr<DcmSequenceOfItems> sequence(new DcmSequenceOfItems(DCM_DimensionOrganizationSequence));
if (!sequence->insert(item.release(), false, false).good() ||
!dataset.insert(sequence.release(), true /* replace */, false).good())
{
uid.assign(tmp);
throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
}
}
if (uid.empty())
{
// Generate an unique identifier for the Dimension Organization
uid = Orthanc::FromDcmtkBridge::GenerateUniqueIdentifier(Orthanc::ResourceType_Instance);
}
// Construct tag "Dimension Index Sequence" (0020,9222)
std::auto_ptr<DcmItem> item(new DcmItem);
OrthancWSI::DicomToolbox::SetStringTag(*item, DCM_DimensionOrganizationUID, organization);
OrthancWSI::DicomToolbox::SetAttributeTag(*item, DCM_FunctionalGroupPointer, DCM_PlanePositionSlideSequence);
OrthancWSI::DicomToolbox::SetAttributeTag(*item, DCM_DimensionIndexPointer, DCM_ColumnPositionInTotalImagePixelMatrix);
dataset.remove(DCM_DimensionIndexSequence);
std::auto_ptr<DcmItem> item2(new DcmItem);
OrthancWSI::DicomToolbox::SetStringTag(*item2, DCM_DimensionOrganizationUID, organization);
OrthancWSI::DicomToolbox::SetAttributeTag(*item2, DCM_FunctionalGroupPointer, DCM_PlanePositionSlideSequence);
OrthancWSI::DicomToolbox::SetAttributeTag(*item2, DCM_DimensionIndexPointer, DCM_RowPositionInTotalImagePixelMatrix);
std::auto_ptr<DcmItem> item(new DcmItem);
std::auto_ptr<DcmSequenceOfItems> sequence(new DcmSequenceOfItems(DCM_DimensionOrganizationSequence));
std::auto_ptr<DcmSequenceOfItems> sequence(new DcmSequenceOfItems(DCM_DimensionIndexSequence));
if (!item->putAndInsertString(DCM_DimensionOrganizationUID, uid.c_str()).good() ||
!sequence->insert(item.release(), false, false).good() ||
!dataset.insert(sequence.release(), true, false).good())
{
throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
if (!sequence->insert(item.release(), false, false).good() ||
!sequence->insert(item2.release(), false, false).good() ||
!dataset.insert(sequence.release(), true /* replace */, false).good())
{
throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
}
}
item.reset(new DcmItem);
sequence.reset(new DcmSequenceOfItems(DCM_DimensionIndexSequence));
std::auto_ptr<DcmAttributeTag> a1(new DcmAttributeTag(DCM_FunctionalGroupPointer));
std::auto_ptr<DcmAttributeTag> a2(new DcmAttributeTag(DCM_DimensionIndexPointer));
if (!item->putAndInsertString(DCM_DimensionOrganizationUID, uid.c_str()).good() ||
!a1->putTagVal(DCM_FrameContentSequence).good() ||
!a2->putTagVal(DCM_DimensionIndexValues).good() ||
!item->insert(a1.release()).good() ||
!item->insert(a2.release()).good() ||
!sequence->insert(item.release(), false, false).good() ||
!dataset.insert(sequence.release(), true, false).good())
{
throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
}
// Construct tag "Shared Functional Groups Sequence" (5200,9229)
float spacingX = volume.GetWidth() / static_cast<float>(source.GetLevelHeight(0)); // Remember to switch X/Y!
float spacingY = volume.GetHeight() / static_cast<float>(source.GetLevelWidth(0)); // Remember to switch X/Y!
std::string spacing = (boost::lexical_cast<std::string>(spacingX) + '\\' +
boost::lexical_cast<std::string>(spacingY));
// In the 2 lines below, remember to switch X/Y when going from physical to pixel coordinates!
float spacingX = volume.GetWidth() / static_cast<float>(source.GetLevelHeight(0));
float spacingY = volume.GetHeight() / static_cast<float>(source.GetLevelWidth(0));
item.reset(new DcmItem);
sequence.reset(new DcmSequenceOfItems(DCM_SharedFunctionalGroupsSequence));
std::auto_ptr<DcmItem> item2(new DcmItem);
std::auto_ptr<DcmItem> item3(new DcmItem);
std::auto_ptr<DcmSequenceOfItems> sequence2(new DcmSequenceOfItems(DCM_PixelMeasuresSequence));
std::auto_ptr<DcmSequenceOfItems> sequence3(new DcmSequenceOfItems(DCM_OpticalPathIdentificationSequence));
std::string spacing = (boost::lexical_cast<std::string>(spacingX) + '\\' +
boost::lexical_cast<std::string>(spacingY));
OrthancWSI::DicomToolbox::SetStringTag(*item2, DCM_SliceThickness, boost::lexical_cast<std::string>(volume.GetDepth()));
OrthancWSI::DicomToolbox::SetStringTag(*item2, DCM_PixelSpacing, spacing);
OrthancWSI::DicomToolbox::SetStringTag(*item3, DCM_OpticalPathIdentifier, opticalPathId);
std::auto_ptr<DcmItem> item(new DcmItem);
if (!sequence2->insert(item2.release(), false, false).good() ||
!sequence3->insert(item3.release(), false, false).good() ||
!item->insert(sequence2.release(), false, false).good() ||
!item->insert(sequence3.release(), false, false).good() ||
!sequence->insert(item.release(), false, false).good() ||
!dataset.insert(sequence.release(), true, false).good())
{
throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
std::auto_ptr<DcmItem> item2(new DcmItem);
OrthancWSI::DicomToolbox::SetStringTag(*item2, DCM_SliceThickness,
boost::lexical_cast<std::string>(volume.GetDepth()));
OrthancWSI::DicomToolbox::SetStringTag(*item2, DCM_PixelSpacing, spacing);
std::auto_ptr<DcmItem> item3(new DcmItem);
OrthancWSI::DicomToolbox::SetStringTag(*item3, DCM_OpticalPathIdentifier, opticalPathId);
std::auto_ptr<DcmSequenceOfItems> sequence(new DcmSequenceOfItems(DCM_SharedFunctionalGroupsSequence));
std::auto_ptr<DcmSequenceOfItems> sequence2(new DcmSequenceOfItems(DCM_PixelMeasuresSequence));
std::auto_ptr<DcmSequenceOfItems> sequence3(new DcmSequenceOfItems(DCM_OpticalPathIdentificationSequence));
if (!sequence2->insert(item2.release(), false, false).good() ||
!sequence3->insert(item3.release(), false, false).good() ||
!item->insert(sequence2.release(), false, false).good() ||
!item->insert(sequence3.release(), false, false).good() ||
!sequence->insert(item.release(), false, false).good() ||
!dataset.insert(sequence.release(), true /* replace */, false).good())
{
throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
}
}
}
......@@ -861,6 +877,7 @@ OrthancWSI::ITiledPyramid* OpenInputPyramid(OrthancWSI::ImageCompression& source
int main(int argc, char* argv[])
{
OrthancWSI::ApplicationToolbox::GlobalInitialize();
OrthancWSI::ApplicationToolbox::ShowVersionInLog(argv[0]);
int exitStatus = 0;
......
......@@ -2,6 +2,7 @@
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017 Osimis, Belgium
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
......
......@@ -2,6 +2,7 @@
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017 Osimis, Belgium
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
......
......@@ -2,6 +2,7 @@
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017 Osimis, Belgium
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
......
......@@ -2,6 +2,7 @@
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017 Osimis, Belgium
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
......
......@@ -2,6 +2,7 @@
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017 Osimis, Belgium
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
......
......@@ -2,6 +2,7 @@
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017 Osimis, Belgium
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
......
......@@ -2,6 +2,7 @@
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017 Osimis, Belgium
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
......@@ -28,6 +29,7 @@
#if ORTHANC_ENABLE_DCMTK == 1
# include <dcmtk/dcmdata/dcelem.h>
# include <dcmtk/dcmdata/dcsequen.h>
# include <dcmtk/dcmdata/dcvrat.h>
#endif
namespace OrthancWSI
......@@ -70,6 +72,23 @@ namespace OrthancWSI
}
void SetAttributeTag(DcmItem& dataset,
const DcmTagKey& key,
const DcmTagKey& value)
{
if (!dataset.tagExists(key))
{
std::auto_ptr<DcmAttributeTag> tag(new DcmAttributeTag(key));
if (!tag->putTagVal(value).good() ||
!dataset.insert(tag.release()).good())
{
throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
}
}
}
DcmItem* ExtractSingleSequenceItem(DcmItem& dataset,
const DcmTagKey& key)
{
......
......@@ -2,6 +2,7 @@
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017 Osimis, Belgium
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
......@@ -47,6 +48,10 @@ namespace OrthancWSI
const DcmTagKey& key,
uint32_t value);
void SetAttributeTag(DcmItem& dataset,
const DcmTagKey& key,
const DcmTagKey& value);
DcmItem* ExtractSingleSequenceItem(DcmItem& dataset,
const DcmTagKey& key);
......
......@@ -2,6 +2,7 @@
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017 Osimis, Belgium
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
......@@ -53,24 +54,26 @@ namespace OrthancWSI
}
DicomizerParameters::DicomizerParameters()
DicomizerParameters::DicomizerParameters() :
safetyCheck_(false),
repaintBackground_(false),
targetCompression_(ImageCompression_Jpeg),
hasTargetTileSize_(false),
targetTileWidth_(512),
targetTileHeight_(512),
maxDicomFileSize_(10 * 1024 * 1024), // 10MB
reconstructPyramid_(false),
pyramidLevelsCount_(0),
pyramidLowerLevelsCount_(0),
smooth_(false),
jpegQuality_(90),
forceReencode_(false),
opticalPath_(OpticalPath_Brightfield)
{
safetyCheck_ = false;
repaintBackground_ = false;
backgroundColor_[0] = 255;
backgroundColor_[1] = 255;
backgroundColor_[2] = 255;
targetCompression_ = ImageCompression_Jpeg;
hasTargetTileSize_ = false;
threadsCount_ = ChooseNumberOfThreads();
maxDicomFileSize_ = 10 * 1024 * 1024; // 10MB
reconstructPyramid_ = false;
pyramidLevelsCount_ = 0;
pyramidLowerLevelsCount_ = 0;
smooth_ = false;
jpegQuality_ = 90;
forceReencode_ = false;
opticalPath_ = OpticalPath_Brightfield;
}
......@@ -146,7 +149,7 @@ namespace OrthancWSI
void DicomizerParameters::SetPyramidLevelsCount(unsigned int count)
{
if (count <= 0)
if (count == 0)
{
throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
}
......@@ -195,7 +198,7 @@ namespace OrthancWSI
void DicomizerParameters::SetPyramidLowerLevelsCount(unsigned int count)
{
if (count <= 0)
if (count == 0)
{
throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
}
......
......@@ -2,6 +2,7 @@
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017 Osimis, Belgium
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
......
......@@ -2,6 +2,7 @@
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017 Osimis, Belgium
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
......
......@@ -2,6 +2,7 @@
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017 Osimis, Belgium
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
......
......@@ -2,6 +2,7 @@
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017 Osimis, Belgium
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
......@@ -221,9 +222,11 @@ namespace OrthancWSI
unsigned int y,
unsigned int channel,
int offsetX,
int offsetY)
int offsetY,
unsigned int bytesPerPixel)
{
assert(channel < source.GetBytesPerPixel());
assert(bytesPerPixel == source.GetBytesPerPixel());
assert(channel < bytesPerPixel);
assert(source.GetFormat() == Orthanc::PixelFormat_Grayscale8 ||
source.GetFormat() == Orthanc::PixelFormat_RGB24 ||
source.GetFormat() == Orthanc::PixelFormat_RGBA32); // 16bpp is unsupported
......@@ -255,14 +258,15 @@ namespace OrthancWSI
}
return *(reinterpret_cast<const uint8_t*>(source.GetConstBuffer()) +
y * source.GetPitch() + x * source.GetBytesPerPixel() + channel);
y * source.GetPitch() + x * bytesPerPixel + channel);
}
static uint8_t SmoothPixelValue(const Orthanc::ImageAccessor& source,
unsigned int x,
unsigned int y,
unsigned int channel)
unsigned int channel,
unsigned int bytesPerPixel)
{
static const uint32_t kernel[5] = { 1, 4, 6, 4, 1 };
static const uint32_t normalization = 2 * (1 + 4 + 6 + 4 + 1);
......@@ -272,13 +276,13 @@ namespace OrthancWSI
// Horizontal smoothing
for (int offset = -2; offset <= 2; offset++)
{
accumulator += kernel[offset + 2] * GetPixelValue(source, x, y, channel, offset, 0);
accumulator += kernel[offset + 2] * GetPixelValue(source, x, y, channel, offset, 0, bytesPerPixel);
}
// Vertical smoothing
for (int offset = -2; offset <= 2; offset++)
{
accumulator += kernel[offset + 2] * GetPixelValue(source, x, y, channel, 0, offset);
accumulator += kernel[offset + 2] * GetPixelValue(source, x, y, channel, 0, offset, bytesPerPixel);
}
return static_cast<uint8_t>(accumulator / normalization);
......@@ -307,6 +311,8 @@ namespace OrthancWSI
source.GetWidth() / 2,
source.GetHeight() / 2));
unsigned int bytesPerPixel = source.GetBytesPerPixel();
for (unsigned int y = 0; y < source.GetHeight() / 2; y++)
{
uint8_t* q = reinterpret_cast<uint8_t*>(result->GetRow(y));
......@@ -317,11 +323,11 @@ namespace OrthancWSI
{
if (smooth)
{
q[c] = SmoothPixelValue(source, 2 * x, 2 * y, c);
q[c] = SmoothPixelValue(source, 2 * x, 2 * y, c, bytesPerPixel);
}
else
{
q[c] = GetPixelValue(source, 2 * x, 2 * y, c, 0, 0);
q[c] = GetPixelValue(source, 2 * x, 2 * y, c, 0, 0, bytesPerPixel);
}
}
}
......
......@@ -2,6 +2,7 @@
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017 Osimis, Belgium
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
......
......@@ -2,6 +2,7 @@
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017 Osimis, Belgium
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
......
......@@ -2,6 +2,7 @@
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017 Osimis, Belgium
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
......
......@@ -2,6 +2,7 @@
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017 Osimis, Belgium
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
......
......@@ -2,6 +2,7 @@
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017 Osimis, Belgium
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
......
......@@ -2,6 +2,7 @@
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017 Osimis, Belgium
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
......