Skip to content
Commits on Source (8)
......@@ -858,7 +858,8 @@ int main (int argc, char *argv[])
|| gdcm::System::StrCaseCmp(inputextension,".rawl") == 0 // kakadu convention for raw little endian
|| gdcm::System::StrCaseCmp(inputextension,".gray") == 0 // imagemagick convention
|| gdcm::System::StrCaseCmp(inputextension,".bin") == 0 // openjp3d convention for raw little endian
|| gdcm::System::StrCaseCmp(inputextension,".rgb") == 0 ) // imagemagick convention
|| gdcm::System::StrCaseCmp(inputextension,".rgb") == 0 // imagemagick convention
|| gdcm::System::StrCaseCmp(inputextension,".yuv") == 0 ) // ffmpeg convention
{
if( !size[0] || !size[1] )
{
......@@ -891,7 +892,7 @@ int main (int argc, char *argv[])
raw.SetPixelFormat( pf );
if( spp )
{
if( pixelspp == 3 ) pi = gdcm::PhotometricInterpretation::RGB;
if( pixelspp == 3 && !pinter ) pi = gdcm::PhotometricInterpretation::RGB;
}
raw.SetPhotometricInterpretation( pi );
raw.SetNeedByteSwap( false );
......
......@@ -189,7 +189,7 @@ static int checkdeflated(const char *name)
static std::string getInfoDate(Dict *infoDict, const char *key)
{
Object obj;
char *s;
const char *s;
int year, mon, day, hour, min, sec, n;
struct tm tmStruct;
//char buf[256];
......@@ -201,7 +201,8 @@ static std::string getInfoDate(Dict *infoDict, const char *key)
if (infoDict->lookup((char*)key, &obj)->isString())
#endif
{
s = obj.getString()->getCString();
const GooString* gs = obj.getString();
s = gs->getCString();
if (s[0] == 'D' && s[1] == ':')
{
s += 2;
......@@ -256,7 +257,7 @@ static std::string getInfoDate(Dict *infoDict, const char *key)
static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uMap)
{
Object obj;
GooString *s1;
const GooString *s1;
GBool isUnicode;
Unicode u;
char buf[8];
......@@ -429,6 +430,7 @@ static int ProcessOneFile( std::string const & filename, gdcm::Defs const & defs
if( md5sum )
{
int ret = 0;
char *buffer = new char[ pimage->GetBufferLength() ];
gdcm::ImageChangePlanarConfiguration icpc;
icpc.SetPlanarConfiguration( 0 );
......@@ -449,9 +451,11 @@ static int ProcessOneFile( std::string const & filename, gdcm::Defs const & defs
}
else
{
std::cout << "Problem decompressing file: " << filename << std::endl;
std::cerr << "Problem decompressing file: " << filename << std::endl;
ret = 1;
}
delete[] buffer;
return ret;
}
}
else if ( ms == gdcm::MediaStorage::EncapsulatedPDFStorage )
......
......@@ -37,7 +37,7 @@
static std::string getInfoDate(Dict *infoDict, const char *key)
{
Object obj;
char *s;
const char *s;
int year, mon, day, hour, min, sec, n;
struct tm tmStruct;
//char buf[256];
......@@ -49,7 +49,8 @@ static std::string getInfoDate(Dict *infoDict, const char *key)
if (infoDict->lookup((char*)key, &obj)->isString())
#endif
{
s = obj.getString()->getCString();
const GooString* gs = obj.getString();
s = gs->getCString();
if (s[0] == 'D' && s[1] == ':')
{
s += 2;
......@@ -104,7 +105,7 @@ static std::string getInfoDate(Dict *infoDict, const char *key)
static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uMap, GBool & unicode)
{
Object obj;
GooString *s1;
const GooString *s1;
GBool isUnicode = gFalse;
Unicode u;
char buf[8];
......
......@@ -41,6 +41,7 @@ macro(install_library library)
EXPORT ${GDCM_TARGETS_NAME}
RUNTIME DESTINATION ${GDCM_INSTALL_BIN_DIR} COMPONENT Applications
LIBRARY DESTINATION ${GDCM_INSTALL_LIB_DIR} COMPONENT Libraries ${NAMELINK_SKIP}
INCLUDES DESTINATION ${GDCM_INSTALL_INCLUDE_DIR}
ARCHIVE DESTINATION ${GDCM_INSTALL_LIB_DIR} COMPONENT DebugDevel
)
# need recent cmake: http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cbe7e8fa
......
......@@ -14,6 +14,9 @@ endif()
if( POLICY CMP0063 )
cmake_policy(SET CMP0063 NEW)
endif()
if( POLICY CMP0074 )
cmake_policy(SET CMP0074 NEW)
endif()
project(GDCM)
set(CMAKE_CXX_STANDARD 98)
set(CMAKE_CXX_EXTENSIONS OFF)
......@@ -40,7 +43,7 @@ set(GDCM_PACKAGE_CONTACT "GDCM Developers <gdcm-developers@lists.sourceforge.net
#----------------------------------------------------------------------------
set(GDCM_MAJOR_VERSION 2)
set(GDCM_MINOR_VERSION 8)
set(GDCM_BUILD_VERSION 7)
set(GDCM_BUILD_VERSION 8)
set(GDCM_VERSION
"${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}.${GDCM_BUILD_VERSION}")
# let advanced user the option to define GDCM_API_VERSION:
......@@ -594,6 +597,11 @@ endif()
# Need to subdirs in Source/Common before Wrapping
# to have gdcmConfigure.h around
if(GDCM_STANDALONE)
set(BUILD_APPLICATIONS ${GDCM_BUILD_APPLICATIONS})
else()
set(BUILD_APPLICATIONS OFF)
endif()
subdirs(Utilities)
add_subdirectory(Source)
......
......@@ -32,6 +32,7 @@ mark_as_advanced(QT_QMAKE_EXECUTABLE)
endif()
set(EXAMPLES_SRCS
PrintLUT
EmptyMask
DumpSiemensBase64
TemplateEmptyImage
......
/*=========================================================================
Program: GDCM (Grassroots DICOM). A DICOM library
Copyright (c) 2006-2011 Mathieu Malaterre
All rights reserved.
See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*
*/
#include "gdcmImageReader.h"
#include "gdcmImageWriter.h"
#include "gdcmImage.h"
#include "gdcmPhotometricInterpretation.h"
#include <iostream>
int main(int argc, char *argv[])
{
if( argc < 2 )
{
std::cerr << argv[0] << " input.dcm" << std::endl;
return 1;
}
const char *filename = argv[1];
// Instanciate the image reader:
gdcm::ImageReader reader;
reader.SetFileName( filename );
if( !reader.Read() )
{
std::cerr << "Could not read: " << filename << std::endl;
return 1;
}
const gdcm::Image &image = reader.GetImage();
const gdcm::LookupTable & lut = image.GetLUT();
lut.Print( std::cout );
return 0;
}
......@@ -218,7 +218,7 @@ bool CAPICryptographicMessageSyntax::Decrypt(char *output, size_t &outlen, const
goto err;
}
DWORD dwMessageType, cbMessageTypeLen;
DWORD dwMessageType, cbMessageTypeLen = sizeof(DWORD);
if(! CryptMsgGetParam(hMsg, CMSG_TYPE_PARAM, 0, &dwMessageType, &cbMessageTypeLen))
{
gdcmErrorMacro( "CryptMsgGetParam CMSG_TYPE_PARAM failed with error 0x" << std::hex << GetLastError() );
......@@ -232,7 +232,7 @@ bool CAPICryptographicMessageSyntax::Decrypt(char *output, size_t &outlen, const
}
ALG_ID kekAlg;
DWORD kekAlgLen;
DWORD kekAlgLen = sizeof(ALG_ID);
if(! CryptGetKeyParam(hRsaPrivK, KP_ALGID, (BYTE*)&kekAlg, &kekAlgLen, 0))
{
gdcmErrorMacro( "MsgGetParam KP_ALGID failed with error 0x" << std::hex << GetLastError() );
......@@ -244,7 +244,7 @@ bool CAPICryptographicMessageSyntax::Decrypt(char *output, size_t &outlen, const
goto err;
}
DWORD nrOfRecipeints, nrOfRecipientsLen;
DWORD nrOfRecipeints, nrOfRecipientsLen = sizeof(DWORD);
if(! CryptMsgGetParam(hMsg, CMSG_RECIPIENT_COUNT_PARAM, 0, &nrOfRecipeints, &nrOfRecipientsLen))
{
gdcmErrorMacro( "Decode CMSG_RECIPIENT_COUNT_PARAM failed with error 0x" << std::hex << GetLastError() );
......
......@@ -73,8 +73,11 @@ unsigned int Directory::Explore(FilenameType const &name, bool recursive)
}
else
{
Filenames.push_back(dirName+fileName);
nFiles++;
if (fileName[0] != '.') // discard "unix like" hidden files such as .git in submodules
{
Filenames.push_back(dirName+fileName);
nFiles++;
}
}
}
DWORD dwError = GetLastError();
......
......@@ -44,12 +44,14 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x0021,0x0004,"SIEMENS MR SDI 02",VR::DS,VM::VM1,"??",false},
{0x0021,0x0004,"SIEMENS MR SDS 01",VR::DS,VM::VM1,"??",false},
{0x0021,0x0005,"SIEMENS MR SDS 01",VR::IS,VM::VM3,"??",false},
{0x0021,0x0005,"SIEMENS MR SDI 02",VR::IS,VM::VM1,"ICE_Dims",false},
{0x0021,0x0006,"SIEMENS MR SDI 02",VR::LO,VM::VM1,"ICE_Dims",false},
{0x0021,0x0006,"SIEMENS MR SDS 01",VR::LO,VM::VM1,"CoilForGradient",false},
{0x0021,0x0007,"SIEMENS MR SDS 01",VR::LO,VM::VM1,"LongModelName",false},
{0x0021,0x0008,"SIEMENS MR SDS 01",VR::SH,VM::VM1,"GradientMode",false},
{0x0021,0x0009,"SIEMENS MR SDS 01",VR::LO,VM::VM1,"PAT mode",false},
{0x0021,0x000a,"SIEMENS MR SDS 01",VR::DS,VM::VM1,"??",false},
{0x0021,0x000c,"SIEMENS MR SDS 01",VR::SH,VM::VM1,"?Orientation?",false},
{0x0021,0x000d,"SIEMENS MR SDS 01",VR::US,VM::VM1,"??",false},
{0x0021,0x000f,"SIEMENS MR SDS 01",VR::DS,VM::VM3,"?Stim_lim?",false},
{0x0021,0x0010,"SIEMENS MR SDS 01",VR::IS,VM::VM1,"PhoenixMetaProtocolVersion",false},
......@@ -61,6 +63,7 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x0021,0x0017,"SIEMENS MR SDS 01",VR::DS,VM::VM1,"??",false},
{0x0021,0x0018,"SIEMENS MR SDS 01",VR::SH,VM::VM1,"?RFSWDMostCriticalAspect?",false},
{0x0021,0x0019,"SIEMENS MR SDS 01",VR::OW,VM::VM1,"PhoenixMetaProtocol",false},
{0x0021,0x001a,"SIEMENS MR SDS 01",VR::LO,VM::VM1,"??",false},
{0x0021,0x001a,"SIEMENS MR SDI 02",VR::SH,VM::VM1,"?RFSWDDataType?",false},
{0x0021,0x001b,"SIEMENS MR SDS 01",VR::DS,VM::VM1,"??",false},
{0x0021,0x001c,"SIEMENS MR SDI 02",VR::IS,VM::VM1,"??",false},
......@@ -68,6 +71,7 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x0021,0x001d,"SIEMENS MR SDS 01",VR::IS,VM::VM1,"??",false},
{0x0021,0x0022,"SIEMENS MR SDS 01",VR::SH,VM::VM1,"Manufacturer",false},
{0x0021,0x0023,"SIEMENS MR SDS 01",VR::IS,VM::VM1,"??",false},
{0x0021,0x0021,"SIEMENS MR SDI 02",VR::CS,VM::VM1,"?DiffusionDirectionality?",false},
{0x0021,0x0024,"SIEMENS MR SDI 02",VR::IS,VM::VM1,"??",false},
{0x0021,0x0025,"SIEMENS MR SDS 01",VR::SL,VM::VM3,"?ImaAbsTablePosition?",false},
{0x0021,0x0026,"SIEMENS MR SDS 01",VR::IS,VM::VM1_n,"?MiscSequenceParam?",false},
......@@ -82,6 +86,7 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x0021,0x0031,"SIEMENS MR SDS 01",VR::IS,VM::VM1,"PtabAbsStartPosZ",false},
{0x0021,0x0032,"SIEMENS MR SDS 01",VR::SS,VM::VM1,"??",false},
{0x0021,0x0033,"SIEMENS MR SDI 02",VR::IS,VM::VM1,"?CoilForGradient2?",false},
{0x0021,0x0035,"SIEMENS MR SDI 02",VR::IS,VM::VM1,"??",false},
{0x0021,0x0033,"SIEMENS MR SDS 01",VR::SH,VM::VM1,"??",false},
{0x0021,0x0034,"SIEMENS MR SDS 01",VR::DS,VM::VM1,"??",false},
{0x0021,0x0035,"SIEMENS MR SDS 01",VR::DS,VM::VM1,"??",false},
......@@ -96,11 +101,17 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x0021,0x0045,"SIEMENS MR SDI 02",VR::SL,VM::VM3,"?Table Position?",false},
{0x0021,0x0045,"SIEMENS MR SDS 01",VR::CS,VM::VM1,"??",false},
{0x0021,0x0046,"SIEMENS MR SDS 01",VR::DS,VM::VM1,"??",false},
{0x0021,0x0047,"SIEMENS MR SDS 01",VR::CS,VM::VM1,"??",false},
{0x0021,0x0048,"SIEMENS MR SDS 01",VR::CS,VM::VM1,"??",false},
{0x0021,0x0049,"SIEMENS MR SDS 01",VR::CS,VM::VM1,"??",false},
{0x0021,0x0048,"SIEMENS MR SDI 02",VR::IS,VM::VM1,"??",false},
{0x0021,0x0049,"SIEMENS MR SDI 02",VR::IS,VM::VM1,"??",false},
{0x0021,0x004f,"SIEMENS MR SDI 02",VR::LO,VM::VM1,"ImaCoilString",false},
{0x0021,0x0050,"SIEMENS MR SDS 01",VR::US,VM::VM1,"??",false},
{0x0021,0x0051,"SIEMENS MR SDI 02",VR::UL,VM::VM1,"?SequenceMask?",false},
{0x0021,0x0053,"SIEMENS MR SDI 02",VR::FD,VM::VM1,"?BandwidthPerPixelPhaseEncode?",false},
{0x0021,0x0054,"SIEMENS MR SDI 02",VR::US,VM::VM1,"??",false},
{0x0021,0x0056,"SIEMENS MR SDI 02",VR::LO,VM::VM1,"?PAT Mode?",false},
{0x0021,0x0051,"SIEMENS MR SDS 01",VR::US,VM::VM1,"??",false},
{0x0021,0x0053,"SIEMENS MR SDS 01",VR::CS,VM::VM1,"??",false},
{0x0021,0x0058,"SIEMENS MR SDI 02",VR::SH,VM::VM1,"AcquisitionMatrixText",false},
......@@ -846,6 +857,7 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x0031,0x0000,"AGFA PACS Archive Mirroring 1.0",VR::CS,VM::VM1,"study_status",false },
/* 001310_IMPAX_6.5.x_Solution_DICOM_Conformance_Statement.pdf states is is VR:CS */
{0x0031,0x0001,"AGFA PACS Archive Mirroring 1.0",VR::UL,VM::VM1,"date_time_verified",false },
{0x0035,0x0000,"AGFA STUDY COMMENTS 1.0",VR::LT,VM::VM1,"Array of Comments (illegal XML)",false },
{0x0071,0x0018,"AGFA-AG_HPState",VR::SQ,VM::VM1,"?",false },
{0x0071,0x0019,"AGFA-AG_HPState",VR::SQ,VM::VM1,"?",false },
{0x0071,0x001a,"AGFA-AG_HPState",VR::SQ,VM::VM1,"?",false },
......@@ -1451,6 +1463,7 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x0019,0x0027,"DLX_SERIE_01",VR::DS,VM::VM1,"Image chain FWHM psf mm min",false },
{0x0019,0x0028,"DLX_SERIE_01",VR::DS,VM::VM1,"Image chain FWHM psf mm max",false },
{0x0015,0x008f,"DL_INTERNAL_USE",VR::IS,VM::VM1,"?",false },
{0x4453,0x0000,"DR Systems, Inc.",VR::LO,VM::VM1,"?kind of identifier?",false },
{0x4453,0x0001,"DR Systems, Inc.",VR::LO,VM::VM1,"DR Exam ID",false },
{0x4453,0x0002,"DR Systems, Inc.",VR::LO,VM::VM1,"DR Image Type",false },
{0x4453,0x0004,"DR Systems, Inc.",VR::LO,VM::VM1,"DR File Type",false },
......@@ -1735,9 +1748,10 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x07a1,0x0071,"ELSCINT1",VR::SH,VM::VM1,"?num?",false },
{0x07a1,0x0075,"ELSCINT1",VR::LO,VM::VM2,"?",false },
{0x07a1,0x0085,"ELSCINT1",VR::UL,VM::VM1,"Tamar Translate Flags",false },
{0x07a1,0x0088,"ELSCINT1",VR::US,VM::VM1,"?",false },
{0x07a1,0x0098,"ELSCINT1",VR::US,VM::VM1,"?",false },
{0x07a1,0x0088,"ELSCINT1",VR::CS,VM::VM1,"?Y/N?",false },
{0x07a1,0x0098,"ELSCINT1",VR::CS,VM::VM1,"?Y/N?",false },
{0x07a1,0x009f,"ELSCINT1",VR::CS,VM::VM1,"?",false },
{0x07a1,0x00c2,"ELSCINT1",VR::ST,VM::VM1,"?status sent?",false },
{0x07a1,0x00d0,"ELSCINT1",VR::LO,VM::VM1,"?",false },
{0x07a3,0x0001,"ELSCINT1",VR::LO,VM::VM1,"Tamar Exe Software Version",false },
{0x07a3,0x0003,"ELSCINT1",VR::CS,VM::VM1,"Tamar Study Has Sticky Note",false },
......@@ -1786,11 +1800,15 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x07a3,0x00ca,"ELSCINT1",VR::SQ,VM::VM1,"?network seq10?",false },
{0x07a3,0x00cb,"ELSCINT1",VR::SQ,VM::VM1,"?network seq11?",false },
{0x07a3,0x00cc,"ELSCINT1",VR::LO,VM::VM1,"Tamar Grid Token Version",false },
{0x07a5,0x0000,"ELSCINT1",VR::LO,VM::VM1,"?",false },
{0x07a3,0x00e3,"ELSCINT1",VR::LO,VM::VM1,"?name?",false },
{0x07a3,0x00f2,"ELSCINT1",VR::CS,VM::VM1,"?",false },
{0x07a3,0x00fb,"ELSCINT1",VR::DT,VM::VM1,"?",false },
{0x07a5,0x0000,"ELSCINT1",VR::LO,VM::VM1,"?name?",false },
{0x07a5,0x0054,"ELSCINT1",VR::DT,VM::VM1,"?",false },
{0x07a5,0x0056,"ELSCINT1",VR::CS,VM::VM1,"?",false },
{0x07a5,0x0063,"ELSCINT1",VR::CS,VM::VM1_n,"?",false },
{0x07a5,0x0069,"ELSCINT1",VR::LO,VM::VM1,"?",false },
{0x07a5,0x00ae,"ELSCINT1",VR::IS,VM::VM1,"?",false },
{0x07a5,0x00c8,"ELSCINT1",VR::CS,VM::VM1,"?",false },
{0x5001,0x0070,"ELSCINT1",VR::SQ,VM::VM1,"?",false },
{0x5001,0x0071,"ELSCINT1",VR::SH,VM::VM1,"?",false },
......@@ -2024,6 +2042,7 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x0053,0x0068,"GEHC_CT_ADVAPP_001",VR::IS,VM::VM1,"Row Number Anotation Flag",false },
{0x0053,0x006a,"GEHC_CT_ADVAPP_001",VR::IS,VM::VM1,"ODMFlag",false },
{0x0053,0x006b,"GEHC_CT_ADVAPP_001",VR::IS,VM::VM1,"ODMReductionPercent",false },
{0x0053,0x006f,"GEHC_CT_ADVAPP_001",VR::IS,VM::VM1,"ASiR Auto Guidance Dose Reduction Percent",false },
{0x0053,0x009d,"GEHC_CT_ADVAPP_001",VR::LO,VM::VM1,"MARsAnnotation",false },
{0x0009,0x0010,"GEIIS",VR::SQ,VM::VM1,"GE IIS Thumbnail Sequence",false },
{0x0009,0x0012,"GEIIS",VR::IS,VM::VM1,"?",false },
......@@ -2805,7 +2824,7 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x0009,0x0030,"GEMS_GENIE_1",VR::LO,VM::VM1,"?",false },
{0x0009,0x0033,"GEMS_GENIE_1",VR::FD,VM::VM1,"Rotational Continuous Speed",false },
{0x0009,0x0034,"GEMS_GENIE_1",VR::SL,VM::VM1,"Gantry Motion Type (retired)",false },
{0x0009,0x0035,"GEMS_GENIE_1",VR::SL,VM::VM1,"Gantry Locus Type",false },
{0x0009,0x0035,"GEMS_GENIE_1",VR::UL,VM::VM1,"Gantry Locus Type",false },
{0x0009,0x0037,"GEMS_GENIE_1",VR::SL,VM::VM1,"Starting Heart Rate",false },
{0x0009,0x0038,"GEMS_GENIE_1",VR::SL,VM::VM1,"RR Window Width",false },
{0x0009,0x0039,"GEMS_GENIE_1",VR::SL,VM::VM1,"RR Window Offset",false },
......@@ -2882,7 +2901,7 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x0011,0x0063,"GEMS_GENIE_1",VR::FD,VM::VM3,"Spatial Offset",false },
{0x0011,0x0064,"GEMS_GENIE_1",VR::FD,VM::VM3,"Spatial Orientation",false },
{0x0011,0x0065,"GEMS_GENIE_1",VR::LO,VM::VM1,"Reference Dataset UID",false },
{0x0011,0x0066,"GEMS_GENIE_1",VR::SH,VM::VM1,"Starcam Reference Dataset",false },
{0x0011,0x0066,"GEMS_GENIE_1",VR::LO,VM::VM1,"Starcam Reference Dataset",false },
{0x0011,0x0067,"GEMS_GENIE_1",VR::SL,VM::VM1,"Reference Frame Number",false },
{0x0011,0x0068,"GEMS_GENIE_1",VR::SL,VM::VM1,"Cursor Length",false },
{0x0011,0x0069,"GEMS_GENIE_1",VR::SL,VM::VM1,"Number of Cursors",false },
......@@ -2924,7 +2943,7 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x0013,0x0011,"GEMS_GENIE_1",VR::SL,VM::VM1,"Source Translator",false },
{0x0013,0x0012,"GEMS_GENIE_1",VR::SL,VM::VM1,"RAL Flags",false },
{0x0013,0x0013,"GEMS_GENIE_1",VR::SQ,VM::VM1,"Xeleris Frame Sequence",false },
{0x0013,0x0014,"GEMS_GENIE_1",VR::SL,VM::VM1,"Original Image Num",false },
{0x0013,0x0014,"GEMS_GENIE_1",VR::SL,VM::VM1_n,"Original Image Num",false },
{0x0013,0x0015,"GEMS_GENIE_1",VR::FD,VM::VM1,"Fscalar",false },
{0x0013,0x0016,"GEMS_GENIE_1",VR::SL,VM::VM1,"AutoTrack Peak",false },
{0x0013,0x0017,"GEMS_GENIE_1",VR::SL,VM::VM1,"AutoTrack Width",false },
......@@ -3366,6 +3385,13 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x0043,0x00b1,"GEMS_PARM_01",VR::SS,VM::VM1,"Excitation Mode",false },
{0x0043,0x00b2,"GEMS_PARM_01",VR::LO,VM::VM1_n,"MR Table Position Information",false },
{0x0043,0x00b3,"GEMS_PARM_01",VR::DS,VM::VM1_n,"Advanced Eddy Correction",false },
{0x0043,0x00b6,"GEMS_PARM_01",VR::LO,VM::VM1_n,"Multiband Parameters",false },
{0x0043,0x00b7,"GEMS_PARM_01",VR::LO,VM::VM4,"Compressed Sensing Parameters",false },
{0x0043,0x00b8,"GEMS_PARM_01",VR::DS,VM::VM1_n,"Grad Comp Parameters",false },
{0x0043,0x00b9,"GEMS_PARM_01",VR::LO,VM::VM1,"Parallel Transmit Information",false },
{0x0043,0x00ba,"GEMS_PARM_01",VR::DS,VM::VM1,"Echo Spacing",false },
{0x0043,0x00bb,"GEMS_PARM_01",VR::LO,VM::VM1_n,"Pixel Information",false },
{0x0043,0x00bc,"GEMS_PARM_01",VR::IS,VM::VM1,"Heart Beats pattern",false },
{0x0051,0x000a,"GEMS_PARM_01",VR::SL,VM::VM1,"Store level of Functional Image",false },
{0x0051,0x000b,"GEMS_PARM_01",VR::FL,VM::VM1,"Store B-Value with Functional Image",false },
{0x2001,0x0010,"GEMS_PARM_01",VR::UI,VM::VM1,"DICOM Implementation UID",false },
......@@ -4547,11 +4573,11 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
// {0x0029,0x0000,"MITRA OBJECT DOCUMENT 1.0",VR::OB,VM::VM1,"?",false },
{0x0033,0x0002,"MITRA OBJECT UTF8 ATTRIBUTES 1.0",VR::OB,VM::VM1,"Patient Name (UTF8 Encoded)",false },
{0x0033,0x0004,"MITRA OBJECT UTF8 ATTRIBUTES 1.0",VR::CS,VM::VM1,"Study Description (UTF8 Encoded)",false },
{0x0033,0x0006,"MITRA OBJECT UTF8 ATTRIBUTES 1.0",VR::OB,VM::VM1,"Referring Physician Name (UTF8 Encoded)",false },
{0x0033,0x0006,"MITRA OBJECT UTF8 ATTRIBUTES 1.0",VR::PN,VM::VM1,"Referring Physician Name (UTF8 Encoded)",false },
{0x0033,0x0008,"MITRA OBJECT UTF8 ATTRIBUTES 1.0",VR::OB,VM::VM1,"Requesting Physician Name (UTF8 Encoded)",false },
{0x0033,0x000a,"MITRA OBJECT UTF8 ATTRIBUTES 1.0",VR::OB,VM::VM1,"Performing Physician Name (UTF8 Encoded)",false },
{0x0033,0x000a,"MITRA OBJECT UTF8 ATTRIBUTES 1.0",VR::PN,VM::VM1,"Performing Physician Name (UTF8 Encoded)",false },
{0x0033,0x000c,"MITRA OBJECT UTF8 ATTRIBUTES 1.0",VR::LO,VM::VM1,"Reason for Study (UTF8 Encoded)",false },
{0x0033,0x000e,"MITRA OBJECT UTF8 ATTRIBUTES 1.0",VR::OB,VM::VM1,"Study Comments (UTF8 Encoded)",false },
{0x0033,0x000e,"MITRA OBJECT UTF8 ATTRIBUTES 1.0",VR::LT,VM::VM1,"Study Comments (UTF8 Encoded)",false },
{0x0033,0x0013,"MITRA OBJECT UTF8 ATTRIBUTES 1.0",VR::PN,VM::VM1,"Patient's Name",false },
{0x0033,0x0014,"MITRA OBJECT UTF8 ATTRIBUTES 1.0",VR::OB,VM::VM1,"?",false },
{0x0033,0x0015,"MITRA OBJECT UTF8 ATTRIBUTES 1.0",VR::OB,VM::VM1,"?",false },
......@@ -4676,6 +4702,10 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x0029,0x0003,"MITRA PRESENTATION 1.0",VR::IS,VM::VM1,"Mitra Invert",false },
{0x0029,0x0004,"MITRA PRESENTATION 1.0",VR::IS,VM::VM1,"Mitra Has Tabstop",false },
{0x0029,0x0005,"MITRA PRESENTATION 1.0",VR::CS,VM::VM1,"Smooth Rotation",false },
{0x0029,0x0010,"MITRA PRESENTATION 1.0",VR::CS,VM::VM1,"??",false },
{0x0029,0x0011,"MITRA PRESENTATION 1.0",VR::CS,VM::VM1,"??",false },
{0x0029,0x0012,"MITRA PRESENTATION 1.0",VR::CS,VM::VM1,"??",false },
{0x0029,0x0013,"MITRA PRESENTATION 1.0",VR::CS,VM::VM1,"??",false },
{0x1455,0x0000,"Mortara_Inc",VR::OW,VM::VM1,"ELI Interpretation Vector",false },
{0x1455,0x0001,"Mortara_Inc",VR::UN,VM::VM1,"Custom ID",false },
{0x1455,0x0002,"Mortara_Inc",VR::UT,VM::VM1,"Race",false },
......@@ -6059,8 +6089,10 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x200b,0x009f,"Philips RAD Imaging DD 097",VR::SQ,VM::VM1,"?",false },
{0x200b,0x00a0,"Philips RAD Imaging DD 097",VR::LT,VM::VM1,"?",false },
{0x200b,0x00a1,"Philips RAD Imaging DD 097",VR::CS,VM::VM1,"?bool?",false },
{0x0029,0x0050,"Philips US Imaging 60",VR::CS,VM::VM1,"?COLOR/CPA/NONE?",false },
{0x0031,0x0030,"Philips US Imaging 60",VR::UL,VM::VM1,"Private data",false },
{0x0031,0x0031,"Philips US Imaging 60",VR::UL,VM::VM1,"Private data",false },
{0x0031,0x0032,"Philips US Imaging 60",VR::UL,VM::VM1,"Private data",false },
{0x200d,0x0005,"Philips US Imaging DD 017",VR::LO,VM::VM1,"?",false },
{0x200d,0x0037,"Philips US Imaging DD 023",VR::DA,VM::VM1,"?",false },
{0x200d,0x0038,"Philips US Imaging DD 023",VR::TM,VM::VM1,"?",false },
......@@ -6228,6 +6260,12 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x200d,0x0020,"Philips US Imaging DD 113",VR::FD,VM::VM1,"?",false },
{0x200d,0x0021,"Philips US Imaging DD 113",VR::FD,VM::VM1,"?",false },
{0x200d,0x0022,"Philips US Imaging DD 113",VR::UL,VM::VM1,"?",false },
{0x200d,0x0024,"Philips US Imaging DD 113",VR::UL,VM::VM1,"?",false },
{0x200d,0x0025,"Philips US Imaging DD 113",VR::UL,VM::VM1,"?",false },
{0x200d,0x0026,"Philips US Imaging DD 113",VR::UL,VM::VM1,"?",false },
{0x200d,0x0027,"Philips US Imaging DD 113",VR::UL,VM::VM1,"?",false },
{0x200d,0x0028,"Philips US Imaging DD 113",VR::UL,VM::VM1,"?",false },
{0x200d,0x0031,"Philips US Imaging DD 113",VR::UL,VM::VM1,"?",false },
{0x200d,0x0002,"Philips US Private 3D",VR::IS,VM::VM1,"Threedpr Echo Vision Setting",false },
{0x200d,0x0003,"Philips US Private 3D",VR::IS,VM::VM1,"Threedpr Color Vision Setting",false },
{0x200d,0x0004,"Philips US Private 3D",VR::IS,VM::VM1,"Threedpr Transparency",false },
......@@ -9842,6 +9880,7 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x700d,0x0007,"TOSHIBA_MEC_MR3",VR::OB,VM::VM1,"Image Information",false },
{0x700d,0x0008,"TOSHIBA_MEC_MR3",VR::OB,VM::VM1,"Original Data",false },
{0x700d,0x0009,"TOSHIBA_MEC_MR3",VR::SS,VM::VM1,"Original Data Flag",false },
{0x700d,0x000c,"TOSHIBA_MEC_MR3",VR::CS,VM::VM1,"?Y/N Flag?",false },
{0x700d,0x0080,"TOSHIBA_MEC_MR3",VR::US,VM::VM1,"Number of PAC channel",false },
{0x700d,0x0081,"TOSHIBA_MEC_MR3",VR::US,VM::VM1,"Reference mode",false },
{0x700d,0x0082,"TOSHIBA_MEC_MR3",VR::SQ,VM::VM1,"Gain value group for MRS",false },
......
......@@ -60,7 +60,7 @@ namespace gdcm
{"1.2.840.10008.5.1.4.1.1.12.2.1" , "Enhanced X Ray RF Image IOD Modules"},
{"1.2.840.10008.5.1.4.1.1.13.1.1" , "X Ray 3D Angiographic Image IOD Modules"},
{"1.2.840.10008.5.1.4.1.1.13.1.2" , "X-Ray 3D Craniofacial Image"},
{"1.2.840.10008.5.1.4.1.1.13.1.3" , "IOD defined in PS 3.3"},
{"1.2.840.10008.5.1.4.1.1.13.1.3" , "Breast Tomosynthesis Image IOD Modules"},
{"1.2.840.10008.5.1.4.1.1.20" , "NM Image IOD Modules"},
{"1.2.840.10008.5.1.4.1.1.66" , "Raw Data IOD Modules"},
{"1.2.840.10008.5.1.4.1.1.66.1" , "Spatial Registration IOD Modules"},
......@@ -112,6 +112,9 @@ namespace gdcm
{"1.2.840.10008.5.1.4.1.1.481.9" , "RT Ion Beams Treatment Record IOD Modules"},
{"1.2.840.10008.5.1.4.38.1" , "Hanging Protocol IOD Modules"},
{"1.2.840.10008.5.1.4.39.1" , "Color Palette IOD"},
{"1.2.840.10008.5.1.4.1.1.2.2", "Legacy Converted Enhanced CT Image IOD Modules"},
{"1.2.840.10008.5.1.4.1.1.4.4", "Legacy Converted Enhanced MR Image IOD Modules"},
{"1.2.840.10008.5.1.4.1.1.128.1", "Legacy Converted Enhanced PET Image IOD Modules"},
// Deprecated:
{"1.2.840.10008.3.1.2.3.3" , "Modality Performed Procedure Step IOD Modules" },
{"1.2.840.10008.5.1.4.1.1.5" , "NM Image IOD Modules"},
......
......@@ -332,6 +332,9 @@ uid_1_2_840_10008_5_1_4_1_1_77_1_6, // VL Whole Slide Microscopy Image Storage
uid_1_2_840_10008_5_1_4_1_1_6_2, // EnhancedUSVolumeStorage
uid_1_2_840_10008_5_1_4_1_1_66_5, // Surface Segmentation Storage
uid_1_2_840_10008_5_1_4_1_1_13_1_3, // Breast Tomosynthesis Image Storage
uid_1_2_840_10008_5_1_4_1_1_2_2, // Legacy Converted Enhanced CT ImageStorage,
uid_1_2_840_10008_5_1_4_1_1_4_4, // Legacy Converted Enhanced MR ImageStorage,
uid_1_2_840_10008_5_1_4_1_1_128_1, // Legacy Converted Enhanced PET ImageStorage
uid_1_2_840_10008_1_2_4_101, // MPEG2 Main Profile @ High Level
uid_1_2_840_10008_1_2_4_102, // MPEG-4 AVC/H.264 High Profile / Level 4.1
uid_1_2_840_10008_1_2_4_103 // MPEG-4 AVC/H.264 BD-compatible High Profile / Level 4.1
......@@ -629,7 +632,10 @@ dicomTransferCapability = 268, // dicomTransferCapability
VLWholeSlideMicroscopyImageStorage,
EnhancedUSVolumeStorage,
SurfaceSegmentationStorage,
BreastTomosynthesisImageStorage
BreastTomosynthesisImageStorage,
LegacyConvertedEnhancedCTImageStorage,
LegacyConvertedEnhancedMRImageStorage,
LegacyConvertedEnhancedPETImageStorage
} TSName;
......
......@@ -45,7 +45,7 @@ bool SequenceOfItems::RemoveItemByIndex( const SizeType position )
{
return false;
}
Items.erase (Items.begin() + position);
Items.erase (Items.begin() + position - 1);
return true;
}
......
......@@ -166,9 +166,12 @@ void Writer::SetFileName(const char *filename)
{
//std::cerr << "Stream: " << filename << std::endl;
//std::cerr << "Ofstream: " << Ofstream << std::endl;
if (Ofstream && Ofstream->is_open())
if (Ofstream)
{
Ofstream->close();
if (Ofstream->is_open())
{
Ofstream->close();
}
delete Ofstream;
}
Ofstream = new std::ofstream();
......
......@@ -132,7 +132,6 @@ unsigned int Bitmap::GetPlanarConfiguration() const
{
if( PlanarConfiguration && PF.GetSamplesPerPixel() != 3 )
{
assert(0);
// LEADTOOLS_FLOWERS-8-PAL-RLE.dcm
// User specify PlanarConfiguration whereas SamplesPerPixel != 3
gdcmWarningMacro(
......
......@@ -174,6 +174,15 @@ std::string DirectoryHelper::RetrieveSOPInstanceUIDFromZPosition(double inZPos,
std::vector<DataSet>::const_iterator itor;
Tag thePosition(0x0020, 0x0032);
Tag theSOPInstanceUID(0x0008, 0x0018);
Tag theSpacingBetweenSlice(0x0018, 0x0088);
double interSlice = 0.01;
if (inDS.begin() != inDS.end() && inDS.begin()->FindDataElement(theSpacingBetweenSlice))
{
DataElement tmpDe = inDS.begin()->GetDataElement(theSpacingBetweenSlice);
Attribute<0x0018,0x0088> tmpAt;
tmpAt.SetFromDataElement(tmpDe);
interSlice = fabs(tmpAt.GetValue())/2.0;
}
std::string blank;//return only if there's a problem
for (itor = inDS.begin(); itor != inDS.end(); itor++)
{
......@@ -182,7 +191,7 @@ std::string DirectoryHelper::RetrieveSOPInstanceUIDFromZPosition(double inZPos,
DataElement de = itor->GetDataElement(thePosition);
Attribute<0x0020,0x0032> at;
at.SetFromDataElement( de );
if (fabs(at.GetValue(2) - inZPos)<0.01)
if (fabs(at.GetValue(2) - inZPos)<interSlice)
{
DataElement de2 = itor->GetDataElement(theSOPInstanceUID);
const ByteValue* theVal = de2.GetByteValue();
......
......@@ -271,11 +271,19 @@ bool ImageChangeTransferSyntax::TryJPEGLSCodec(const DataElement &pixelde, Bitma
r = codec->Code(pixelde, out);
}
if(!r) return false;
output.SetPlanarConfiguration( 0 );
DataElement &de = output.GetDataElement();
de.SetValue( out.GetValue() );
UpdatePhotometricInterpretation( input, output );
if( input.GetPixelFormat().GetSamplesPerPixel() == 3 )
{
if( input.GetPlanarConfiguration() == 0 )
{
// http://dicom.nema.org/medical/dicom/current/output/chtml/part05/sect_8.2.3.html#table_8.2.3-1
output.SetPlanarConfiguration(1);
}
}
return r;
}
return false;
......
......@@ -428,7 +428,11 @@ std::vector<double> ImageHelper::GetOriginValue(File const & f)
|| ms == MediaStorage::XRay3DCraniofacialImageStorage
|| ms == MediaStorage::SegmentationStorage
|| ms == MediaStorage::IVOCTForProcessing
|| ms == MediaStorage::IVOCTForPresentation)
|| ms == MediaStorage::IVOCTForPresentation
|| ms == MediaStorage::BreastTomosynthesisImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedMRImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedCTImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedPETImageStorage )
{
const Tag t1(0x5200,0x9229);
const Tag t2(0x5200,0x9230);
......@@ -552,7 +556,11 @@ std::vector<double> ImageHelper::GetDirectionCosinesValue(File const & f)
|| ms == MediaStorage::XRay3DCraniofacialImageStorage
|| ms == MediaStorage::SegmentationStorage
|| ms == MediaStorage::IVOCTForPresentation
|| ms == MediaStorage::IVOCTForProcessing )
|| ms == MediaStorage::IVOCTForProcessing
|| ms == MediaStorage::BreastTomosynthesisImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedMRImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedCTImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedPETImageStorage )
{
const Tag t1(0x5200,0x9229);
const Tag t2(0x5200,0x9230);
......@@ -866,7 +874,11 @@ void ImageHelper::SetDimensionsValue(File& f, const Pixmap & img)
|| ms == MediaStorage::XRay3DCraniofacialImageStorage
|| ms == MediaStorage::SegmentationStorage
|| ms == MediaStorage::IVOCTForProcessing
|| ms == MediaStorage::IVOCTForPresentation )
|| ms == MediaStorage::IVOCTForPresentation
|| ms == MediaStorage::BreastTomosynthesisImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedMRImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedCTImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedPETImageStorage )
{
const Tag tfgs(0x5200,0x9230);
if( ds.FindDataElement( tfgs ) )
......@@ -891,7 +903,11 @@ std::vector<double> ImageHelper::GetRescaleInterceptSlopeValue(File const & f)
|| ms == MediaStorage::EnhancedPETImageStorage
|| ms == MediaStorage::XRay3DAngiographicImageStorage
|| ms == MediaStorage::XRay3DCraniofacialImageStorage
|| ms == MediaStorage::SegmentationStorage )
|| ms == MediaStorage::SegmentationStorage
|| ms == MediaStorage::BreastTomosynthesisImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedMRImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedCTImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedPETImageStorage )
{
const Tag t1(0x5200,0x9229);
const Tag t2(0x5200,0x9230);
......@@ -901,6 +917,37 @@ std::vector<double> ImageHelper::GetRescaleInterceptSlopeValue(File const & f)
assert( interceptslope.size() == 2 );
return interceptslope;
}
// Workaround to get intercept/slope from some Philips
// XRay3DAngiographic files
if (ms == MediaStorage::XRay3DAngiographicImageStorage && ForceRescaleInterceptSlope)
{
const Tag t3(0x0018,0x9530);
if(ds.FindDataElement( t3 ))
{
SmartPointer<SequenceOfItems> sqi = ds.GetDataElement( t3 ).GetValueAsSQ();
if(sqi && sqi->GetNumberOfItems() > 0)
{
const Item &item = sqi->GetItem(1);
const DataSet & subds = item.GetNestedDataSet();
const Tag tpi(0x0028,0x1052);
const Tag tps(0x0028,0x1053);
if( subds.FindDataElement(tps) && subds.FindDataElement(tpi))
{
const DataElement &dei = subds.GetDataElement( tpi );
Attribute<0x0028,0x1052> ati;
ati.SetFromDataElement( dei );
interceptslope.push_back( ati.GetValue() );
const DataElement &des = subds.GetDataElement( tps );
Attribute<0x0028,0x1053> ats;
ats.SetFromDataElement( des );
interceptslope.push_back( ats.GetValue() );
return interceptslope;
}
}
}
}
//else
// {
// interceptslope.resize( 2 );
......@@ -1202,7 +1249,11 @@ std::vector<double> ImageHelper::GetSpacingValue(File const & f)
|| ms == MediaStorage::XRay3DCraniofacialImageStorage
|| ms == MediaStorage::SegmentationStorage
|| ms == MediaStorage::IVOCTForProcessing
|| ms == MediaStorage::IVOCTForPresentation)
|| ms == MediaStorage::IVOCTForPresentation
|| ms == MediaStorage::BreastTomosynthesisImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedMRImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedCTImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedPETImageStorage)
{
// <entry group="5200" element="9230" vr="SQ" vm="1" name="Per-frame Functional Groups Sequence"/>
const Tag t1(0x5200,0x9229);
......@@ -1477,7 +1528,11 @@ void ImageHelper::SetSpacingValue(DataSet & ds, const std::vector<double> & spac
|| ms == MediaStorage::XRay3DCraniofacialImageStorage
|| ms == MediaStorage::SegmentationStorage
|| ms == MediaStorage::IVOCTForPresentation
|| ms == MediaStorage::IVOCTForProcessing )
|| ms == MediaStorage::IVOCTForProcessing
|| ms == MediaStorage::BreastTomosynthesisImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedMRImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedCTImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedPETImageStorage )
{
/*
(0028,9110) SQ (Sequence with undefined length #=1) # u/l, 1 PixelMeasuresSequence
......@@ -1799,7 +1854,11 @@ void ImageHelper::SetOriginValue(DataSet & ds, const Image & image)
&& ms != MediaStorage::EnhancedPETImageStorage
&& ms != MediaStorage::EnhancedCTImageStorage
&& ms != MediaStorage::IVOCTForPresentation
&& ms != MediaStorage::IVOCTForProcessing )
&& ms != MediaStorage::IVOCTForProcessing
&& ms != MediaStorage::BreastTomosynthesisImageStorage
&& ms != MediaStorage::LegacyConvertedEnhancedMRImageStorage
&& ms != MediaStorage::LegacyConvertedEnhancedCTImageStorage
&& ms != MediaStorage::LegacyConvertedEnhancedPETImageStorage )
{
// FIXME: should I remove the ipp tag ???
return;
......@@ -1814,7 +1873,11 @@ void ImageHelper::SetOriginValue(DataSet & ds, const Image & image)
|| ms == MediaStorage::MultiframeGrayscaleByteSecondaryCaptureImageStorage
|| ms == MediaStorage::SegmentationStorage
|| ms == MediaStorage::IVOCTForPresentation
|| ms == MediaStorage::IVOCTForProcessing )
|| ms == MediaStorage::IVOCTForProcessing
|| ms == MediaStorage::BreastTomosynthesisImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedMRImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedCTImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedPETImageStorage)
{
/*
(0020,9113) SQ (Sequence with undefined length #=1) # u/l, 1 PlanePositionSequence
......@@ -1928,7 +1991,11 @@ void ImageHelper::SetDirectionCosinesValue(DataSet & ds, const std::vector<doubl
&& ms != MediaStorage::EnhancedPETImageStorage
&& ms != MediaStorage::EnhancedCTImageStorage
&& ms != MediaStorage::IVOCTForPresentation
&& ms != MediaStorage::IVOCTForProcessing )
&& ms != MediaStorage::IVOCTForProcessing
&& ms != MediaStorage::BreastTomosynthesisImageStorage
&& ms != MediaStorage::LegacyConvertedEnhancedMRImageStorage
&& ms != MediaStorage::LegacyConvertedEnhancedCTImageStorage
&& ms != MediaStorage::LegacyConvertedEnhancedPETImageStorage )
{
// FIXME: should I remove the iop tag ???
return;
......@@ -1962,7 +2029,11 @@ void ImageHelper::SetDirectionCosinesValue(DataSet & ds, const std::vector<doubl
|| ms == MediaStorage::XRay3DCraniofacialImageStorage
|| ms == MediaStorage::SegmentationStorage
|| ms == MediaStorage::IVOCTForPresentation
|| ms == MediaStorage::IVOCTForProcessing )
|| ms == MediaStorage::IVOCTForProcessing
|| ms == MediaStorage::BreastTomosynthesisImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedMRImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedCTImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedPETImageStorage )
{
/*
(0020,9116) SQ (Sequence with undefined length #=1) # u/l, 1 PlaneOrientationSequence
......@@ -2075,7 +2146,11 @@ void ImageHelper::SetRescaleInterceptSlopeValue(File & f, const Image & img)
&& ms != MediaStorage::XRay3DCraniofacialImageStorage
&& ms != MediaStorage::SegmentationStorage
&& ms != MediaStorage::IVOCTForPresentation
&& ms != MediaStorage::IVOCTForProcessing )
&& ms != MediaStorage::IVOCTForProcessing
&& ms != MediaStorage::BreastTomosynthesisImageStorage
&& ms != MediaStorage::LegacyConvertedEnhancedMRImageStorage
&& ms != MediaStorage::LegacyConvertedEnhancedCTImageStorage
&& ms != MediaStorage::LegacyConvertedEnhancedPETImageStorage )
{
if( img.GetIntercept() != 0. || img.GetSlope() != 1. )
{
......@@ -2090,7 +2165,10 @@ void ImageHelper::SetRescaleInterceptSlopeValue(File & f, const Image & img)
|| ms == MediaStorage::EnhancedPETImageStorage
|| ms == MediaStorage::XRay3DAngiographicImageStorage
|| ms == MediaStorage::XRay3DCraniofacialImageStorage
)
|| ms == MediaStorage::BreastTomosynthesisImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedMRImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedCTImageStorage
|| ms == MediaStorage::LegacyConvertedEnhancedPETImageStorage )
{
/*
(0020,9116) SQ (Sequence with undefined length #=1) # u/l, 1 PlaneOrientationSequence
......
......@@ -109,6 +109,7 @@ bool JPEGLSCodec::GetHeaderInfo(std::istream &is, TransferSyntax &ts)
else if( metadata.components == 3 )
{
PI = PhotometricInterpretation::RGB;
PlanarConfiguration = 1;
this->PF.SetSamplesPerPixel( 3 );
}
else assert(0);
......
......@@ -12,8 +12,11 @@
=========================================================================*/
#include "gdcmLookupTable.h"
#include "gdcmSwapper.h"
#include <vector>
#include <set>
#include <iomanip>
#include <algorithm>
#include <string.h>
......@@ -550,6 +553,62 @@ bool LookupTable::Decode(char *output, size_t outlen, const char *input, size_t
return success;
}
bool LookupTable::Decode8(char *output, size_t outlen, const char *input, size_t inlen ) const
{
bool success = false;
if( outlen < 3 * inlen )
{
gdcmDebugMacro( "Out buffer too small" );
return false;
}
if( !Initialized() )
{
gdcmDebugMacro( "Not Initialized" );
return false;
}
if ( BitSample == 8 )
{
const unsigned char * end = (const unsigned char*)input + inlen;
unsigned char * rgb = (unsigned char*)output;
for( const unsigned char * idx = (const unsigned char*)input; idx != end; ++idx )
{
if( IncompleteLUT )
{
assert( *idx < Internal->Length[RED] );
assert( *idx < Internal->Length[GREEN] );
assert( *idx < Internal->Length[BLUE] );
}
rgb[RED] = Internal->RGB[3 * *idx+RED];
rgb[GREEN] = Internal->RGB[3 * *idx+GREEN];
rgb[BLUE] = Internal->RGB[3 * *idx+BLUE];
rgb += 3;
}
success = true;
}
else if ( BitSample == 16 )
{
const uint16_t *rgb16 = (const uint16_t*)&Internal->RGB[0];
assert( inlen % 2 == 0 );
const uint16_t * end = (const uint16_t*)(input + inlen);
uint8_t * rgb = (uint8_t*)output;
for( const uint16_t * idx = (const uint16_t*)input; idx != end; ++idx )
{
if( IncompleteLUT )
{
assert( *idx < Internal->Length[RED] );
assert( *idx < Internal->Length[GREEN] );
assert( *idx < Internal->Length[BLUE] );
}
rgb[RED] = rgb16[3 * *idx+RED] >> 8;
rgb[GREEN] = rgb16[3 * *idx+GREEN] >> 8;
rgb[BLUE] = rgb16[3 * *idx+BLUE] >> 8;
rgb += 3;
}
success = true;
}
return success;
}
const unsigned char *LookupTable::GetPointer() const
{
if ( BitSample == 8 )
......@@ -669,4 +728,61 @@ bool LookupTable::WriteBufferAsRGBA(const unsigned char *rgba)
return ret;
}
void LookupTable::Print(std::ostream &os) const
{
if( BitSample == 16 )
{
uint16_t maxlut[3] = { 0 , 0 , 0};
uint16_t minlut[3] = { 0xffff, 0xffff, 0xffff };
uint16_t *uchar16 = (uint16_t*)&Internal->RGB[0];
if( Internal->Length[BLUE] != Internal->Length[RED]
|| Internal->Length[RED] != Internal->Length[GREEN] ) return;
for( unsigned int i = 0; i < Internal->Length[BLUE]; ++i)
{
os << std::dec <<std::setw( 5 ) << std::setfill( '0' ) << i << " : ";
for(int type = RED; type <= BLUE; ++type )
{
assert( 2*(3*i+type) < Internal->RGB.size() );
const uint16_t val = SwapperDoOp::Swap(uchar16[3*i+type]);
minlut[type] = std::min( minlut[type], val );
maxlut[type] = std::max( maxlut[type], val );
os << std::hex << std::setw( 4 ) << std::setfill( '0' ) << val << ",";
}
os << std::endl;
}
os << "MINLUT: ";
for(int type = RED; type <= BLUE; ++type )
os << std::hex << std::setw( 4 ) << std::setfill( '0' ) << minlut[type] << ",";
os << std::endl;
os << "MAXLUT: ";
for(int type = RED; type <= BLUE; ++type )
os << std::hex << std::setw( 4 ) << std::setfill( '0' ) << maxlut[type] << ",";
os << std::endl;
}
}
bool LookupTable::IsRGB8() const
{
if( BitSample == 16 )
{
uint16_t maxlut[3] = { 0 , 0 , 0};
uint16_t minlut[3] = { 0xffff, 0xffff, 0xffff };
uint16_t *uchar16 = (uint16_t*)&Internal->RGB[0];
if( Internal->Length[BLUE] != Internal->Length[RED]
|| Internal->Length[RED] != Internal->Length[GREEN] ) return false;
for( unsigned int i = 0; i < Internal->Length[BLUE]; ++i)
{
for(int type = RED; type <= BLUE; ++type )
{
assert( 2*(3*i+type) < Internal->RGB.size() );
const uint16_t val = SwapperDoOp::Swap(uchar16[3*i+type]);
minlut[type] = std::min( minlut[type], val );
maxlut[type] = std::max( maxlut[type], val );
if( maxlut[type] > 0xff ) return false;
}
}
}
return true;
}
} // end namespace gdcm