Import Upstream version 3.0.22

This commit is contained in:
luoyaoming 2024-04-24 14:59:03 +08:00
parent 3e01ee5ab5
commit 9420fd38b5
276 changed files with 942 additions and 2419 deletions

125
.clang-tidy Normal file
View File

@ -0,0 +1,125 @@
Checks: '-*,
android-*,
-android-cloexec-fopen,
bugprone-*,
-bugprone-narrowing-conversions,
-bugprone-sizeof-expression,
-bugprone-signed-char-misuse,
-bugprone-branch-clone,
-bugprone-easily-swappable-parameters,
-bugprone-not-null-terminated-result,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-exception-escape,
-bugprone-suspicious-memory-comparison,
-bugprone-assignment-in-if-condition,
-bugprone-unhandled-self-assignment,
-bugprone-macro-parentheses,
-bugprone-undefined-memory-manipulation,
-bugprone-parent-virtual-call,
-bugprone-reserved-identifier,
cert-*,
-cert-str34-c,
-cert-err58-cpp,
-cert-dcl37-c,
-cert-dcl51-cpp,
-cert-err34-c,
-cert-msc30-c,
-cert-msc50-cpp,
-cert-dcl03-c,
-cert-exp42-c,
-cert-flp37-c,
-cert-oop54-cpp,
-cert-err33-c,
-cert-msc32-c,
-cert-msc51-cpp,
clang-analyzer-*,
-clang-analyzer-valist.Uninitialized,
-clang-analyzer-alpha.clone.CloneChecker,
-clang-analyzer-alpha.deadcode.UnreachableCode,
-clang-analyzer-optin.cplusplus.VirtualCall,
-clang-analyzer-core.StackAddressEscape,
-clang-analyzer-deadcode.DeadStores,
-clang-analyzer-cplusplus.NewDeleteLeaks,
-clang-analyzer-cplusplus.NewDelete,
-clang-analyzer-core.UndefinedBinaryOperatorResult,
-clang-analyzer-core.CallAndMessage,
-clang-analyzer-unix.cstring.NullArg,
-clang-analyzer-optin.performance.Padding,
-clang-analyzer-core.uninitialized.Assign,
-clang-analyzer-security.insecureAPI.rand,
-clang-analyzer-security.insecureAPI.strcpy,
-clang-analyzer-core.uninitialized.UndefReturn,
-clang-analyzer-core.DivideZero,
-clang-analyzer-core.NullDereference,
google-*,
-google-readability-avoid-underscore-in-googletest-name,
-google-readability-todo,
-google-runtime-int,
-google-readability-casting,
-google-readability-braces-around-statements,
-google-readability-namespace-comments,
-google-build-using-namespace,
-google-explicit-constructor,
-google-default-arguments,
-google-readability-function-size,
hicpp-*,
-hicpp-no-array-decay,
-hicpp-avoid-c-arrays,
-hicpp-vararg,
-hicpp-no-malloc,
-hicpp-special-member-functions,
-hicpp-use-emplace,
-hicpp-use-auto,
-hicpp-member-init,
-hicpp-deprecated-headers,
-hicpp-uppercase-literal-suffix,
-hicpp-signed-bitwise,
-hicpp-named-parameter,
-hicpp-braces-around-statements,
-hicpp-exception-baseclass,
-hicpp-explicit-conversions,
-hicpp-static-assert,
-hicpp-multiway-paths-covered,
-hicpp-use-equals-default,
-hicpp-function-size,
misc-*,
-misc-no-recursion,
-misc-const-correctness,
-misc-static-assert,
-misc-non-private-member-variables-in-classes,
-misc-unconventional-assign-operator,
-misc-redundant-expression,
performance-*,
-performance-unnecessary-value-param,
-performance-unnecessary-copy-initialization,
readability-*,
-readability-magic-numbers,
-readability-else-after-return,
-readability-identifier-length,
-readability-implicit-bool-conversion,
-readability-uppercase-literal-suffix,
-readability-isolate-declaration,
-readability-named-parameter,
-readability-simplify-boolean-expr,
-readability-suspicious-call-argument,
-readability-container-data-pointer,
-readability-braces-around-statements,
-readability-static-accessed-through-instance,
-readability-convert-member-functions-to-static,
-readability-redundant-member-init,
-readability-non-const-parameter,
-readability-inconsistent-declaration-parameter-name,
-readability-redundant-string-cstr,
-readability-make-member-function-const,
-readability-static-definition-in-anonymous-namespace,
-readability-function-size,
-readability-string-compare,
-readability-redundant-preprocessor'
CheckOptions:
- key: readability-function-cognitive-complexity.IgnoreMacros
value: 1
- key: readability-function-cognitive-complexity.Threshold
value: 299
- key: bugprone-reserved-identifier.AllowedIdentifiers
value: _FILE_OFFSET_BITS

12
.gitignore vendored
View File

@ -1,12 +0,0 @@
# back-up
*~
*.bak
# files when there are conflicts
*.orig
# qtcreator files
CMakeLists.txt.user*
# kdevelop files
*.kdev*

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "Testing/Data"]
path = Testing/Data
url = git://git.code.sf.net/p/gdcm/gdcmdata

View File

@ -434,7 +434,8 @@ int main(int argc, char *argv[])
// assert( outfilename.empty() );
// outfilename = optarg;
// }
/*else*/ if( option_index == 2 ) /* root-uid */
//else...
if( option_index == 2 ) /* root-uid */
{
assert( strcmp(s, "root-uid") == 0 );
assert( root.empty() );

View File

@ -187,32 +187,32 @@ int main(int argc, char *argv[]) {
gdcm::PrivateTag privatetag;
gdcm::DPath dpath;
while (1) {
while (true) {
// int this_option_optind = optind ? optind : 1;
int option_index = 0;
static struct option long_options[] = {
{"input", required_argument, NULL, 'i'}, // i
{"output", required_argument, NULL, 'o'}, // o
{"recursive", no_argument, NULL, 'r'},
{"input", required_argument, nullptr, 'i'}, // i
{"output", required_argument, nullptr, 'o'}, // o
{"recursive", no_argument, nullptr, 'r'},
{"empty", required_argument, &empty_tag, 1}, // 3
{"remove", required_argument, &remove_tag, 1}, // 4
{"scrub", required_argument, &scrub_tag, 1}, // 5
{"preserve", required_argument, &preserve_tag, 1}, // 5
{"continue", no_argument, NULL, 'c'},
{"continue", no_argument, nullptr, 'c'},
{"skip-meta", 0, &skipmeta, 1}, // should I document this one ?
{"preserve-missing-private-creator", 0,
&preserveAllMissingPrivateCreator, 1}, //
{"preserve-group-length", 0, &preserveAllGroupLength, 1}, //
{"preserve-illegal", 0, &preserveAllIllegal, 1}, //
{"verbose", no_argument, NULL, 'V'},
{"warning", no_argument, NULL, 'W'},
{"debug", no_argument, NULL, 'D'},
{"error", no_argument, NULL, 'E'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'v'},
{"verbose", no_argument, nullptr, 'V'},
{"warning", no_argument, nullptr, 'W'},
{"debug", no_argument, nullptr, 'D'},
{"error", no_argument, nullptr, 'E'},
{"help", no_argument, nullptr, 'h'},
{"version", no_argument, nullptr, 'v'},
{0, 0, 0, 0}};
{nullptr, 0, nullptr, 0}};
c = getopt_long(argc, argv, "i:o:rcVWDEhv", long_options, &option_index);
if (c == -1) {

View File

@ -976,7 +976,7 @@ int main (int argc, char *argv[])
tsuid.push_back( 0 ); // 0 padding
}
gdcm::DataElement de( gdcm::Tag(0x0002,0x0010) );
de.SetByteValue( &tsuid[0], (uint32_t)tsuid.size() );
de.SetByteValue( tsuid.data(), (uint32_t)tsuid.size() );
de.SetVR( gdcm::Attribute<0x0002, 0x0010>::GetVR() );
fmi.Clear();
fmi.Replace( de );
@ -1412,7 +1412,7 @@ int main (int argc, char *argv[])
std::vector<char> buffer;
buffer.resize(len); // black image
ir.GetBuffer( &buffer[0] );
ir.GetBuffer( buffer.data() );
gdcm::ByteValue *bv = new gdcm::ByteValue(buffer);
gdcm::DataElement pixeldata( gdcm::Tag(0x7fe0,0x0010) );
pixeldata.SetValue( *bv );

View File

@ -351,7 +351,7 @@ static bool DumpToshibaDTI( const char * input, size_t len )
std::reverse( copy.begin(), copy.end() );
std::istringstream is;
std::string dup( &copy[0], copy.size() );
std::string dup( copy.data(), copy.size() );
is.str( dup );
gdcm::File file;
@ -995,7 +995,7 @@ static int PrintMedComHistory(const std::string & filename, bool verbose)
const size_t size = bv->GetLength();
std::u16string u16((size / 2) + 0, '\0');
bv->GetBuffer( (char*)&u16[0], size );
bv->GetBuffer( (char*)u16.data(), size );
#ifdef GDCM_HAVE_CODECVT
std::string utf8 = std::wstring_convert<
@ -1054,10 +1054,10 @@ static int PrintCSABase64Impl(gdcm::CSAHeader &csa, std::string const & csaname
size_t dl = gdcm::Base64::GetDecodeLength( str.c_str(), str.size() );
std::vector<char> buf;
buf.resize( dl );
size_t dl2 = gdcm::Base64::Decode( &buf[0], buf.size(), str.c_str(), str.size() );
size_t dl2 = gdcm::Base64::Decode( buf.data(), buf.size(), str.c_str(), str.size() );
if( dl != dl2 ) return 1;
std::stringstream ss;
ss.str( std::string(&buf[0], buf.size()) );
ss.str( std::string(buf.data(), buf.size()) );
gdcm::File file;
gdcm::DataSet &ds2 = file.GetDataSet();
gdcm::DataElement xde;

View File

@ -208,9 +208,9 @@ int main(int argc, char *argv[])
&& outfilename.empty()
)
{
filename = files[0].c_str();
filename = files[0];
filenames = files;
outfilename = files[ files.size() - 1 ].c_str();
outfilename = files[ files.size() - 1 ];
filenames.pop_back();
}
else

View File

@ -534,7 +534,7 @@ int main(int argc, char *argv[])
if( !gdcm::ImageHelper::GetDirectionCosinesFromDataSet(w.GetFile().GetDataSet(), iop_orig) )
{
erroriop = true;
gdcm::DirectionCosines dc( &iop_orig[0] );
gdcm::DirectionCosines dc( iop_orig.data() );
assert( !dc.IsValid() );
{
gdcm::Attribute<0x0008,0x0008> imagetype;
@ -551,7 +551,7 @@ int main(int argc, char *argv[])
else if( str == "LOCALIZER" )
{
static const double fake_axial[] = { 1, 0, 0, 0, 0, 0 };
assert( memcmp( &iop_orig[0], fake_axial, 6 * sizeof( double ) ) == 0 ); (void)fake_axial;
assert( memcmp( iop_orig.data(), fake_axial, 6 * sizeof( double ) ) == 0 ); (void)fake_axial;
w.GetFile().GetDataSet().Replace( at_axial.GetAsDataElement() );
erroriop = false; // error has been corrected
}

View File

@ -324,7 +324,7 @@ int main(int argc, char *argv[])
}
gdcm::Directory d;
unsigned int nfiles = d.Load( dirname.c_str(), recursive );
unsigned int nfiles = d.Load( dirname, recursive );
if( !nfiles )
{
std::cerr << "No files found in: " << dirname << std::endl;

View File

@ -413,7 +413,7 @@ static bool ConcatenateImages(Image &im1, Image const &im2)
const std::vector<char> & v2 = *bv2;
v1.insert( v1.end(), v2.begin(), v2.end() );
de1.SetByteValue(&v1[0], (uint32_t)v1.size());
de1.SetByteValue(v1.data(), (uint32_t)v1.size());
}
else if( de1.GetSequenceOfFragments() )
{
@ -459,7 +459,7 @@ static int MakeImageEnhanced( std::string const & filename, std::string const &o
}
gdcm::Directory d;
d.Load( filename.c_str(), true ); // recursive !
d.Load( filename, true ); // recursive !
gdcm::Scanner s;
s.AddTag( gdcm::T0 );
@ -1026,12 +1026,12 @@ int main (int argc, char *argv[])
assert( pattern.empty() );
pattern = optarg;
}
else if( option_index == 6 ) /* root uid */
else if( option_index == 6 ) /* root uid */
{
assert( strcmp(s, "root-uid") == 0 );
root = optarg;
}
else if( option_index == 7 ) /* resourcespath */
else if( option_index == 7 ) /* resourcespath */
{
assert( strcmp(s, "resources-path") == 0 );
assert( xmlpath.empty() );

View File

@ -37,9 +37,9 @@ get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
if(EXISTS ${SELF_DIR}/GDCMTargets.cmake)
# This is an install tree
include(${SELF_DIR}/GDCMTargets.cmake)
get_filename_component(GDCM_INCLUDE_ROOT "${SELF_DIR}/../../../@GDCM_INSTALL_INCLUDE_DIR@" ABSOLUTE)
get_filename_component(GDCM_INCLUDE_ROOT "${SELF_DIR}/../../@GDCM_INSTALL_INCLUDE_DIR@" ABSOLUTE)
set(GDCM_INCLUDE_DIRS ${GDCM_INCLUDE_ROOT})
get_filename_component(GDCM_LIB_ROOT "${SELF_DIR}/../../../@GDCM_INSTALL_LIB_DIR@" ABSOLUTE)
get_filename_component(GDCM_LIB_ROOT "${SELF_DIR}/../../@GDCM_INSTALL_LIB_DIR@" ABSOLUTE)
set(GDCM_LIBRARY_DIRS ${GDCM_LIB_ROOT})
else()
if(EXISTS ${SELF_DIR}/GDCMExports.cmake)

View File

@ -17,7 +17,7 @@ endif()
#----------------------------------------------------------------------------
project(GDCM
VERSION 3.0.21
VERSION 3.0.22
LANGUAGES CXX C
)
## NOTE: the "DESCRIPTION" feature of project() was introduced in cmake 3.10.0

View File

@ -260,7 +260,7 @@ int main(int argc, char *argv[])
}
gdcm::Directory d;
d.Load( dir1.c_str(), true ); // recursive !
d.Load( dir1, true ); // recursive !
gdcm::Scanner s;
s.AddTag( gdcm::t1 );

View File

@ -312,7 +312,7 @@ bool DumpADAC( std::istream & is )
float val = readfloat32(is);
os << "" << std::dec << val << "";
}
else
else
{
assert( 0 );
}

View File

@ -456,7 +456,7 @@ Wotsit ?
{
if( de1.IsEmpty() ) return false;
const gdcm::ByteValue * bv1 = de1.GetByteValue();
gdcm::Element<gdcm::VR::SL,gdcm::VM::VM1> dlen = {{0l}};
gdcm::Element<gdcm::VR::SL,gdcm::VM::VM1> dlen = {{0L}};
dlen.SetFromDataElement( de2 );
std::string s1( bv1->GetPointer() , bv1->GetLength() );

View File

@ -60,13 +60,13 @@ std::istream & element::read( std::istream & is )
bytes.resize( l - 16 );
if( !bytes.empty() )
{
is.read( &bytes[0], l - 16 );
is.read( bytes.data(), l - 16 );
}
//os << "pos:" << is.tellg() << std::endl;
if( strcmp(str, "TUSREMEASUREMENT" ) == 0 )
{
const char *p = &bytes[0];
const char *p = bytes.data();
uint32_t val;
memcpy( (char*)&val, p, sizeof(val) );
os << " " << val << std::endl;

View File

@ -129,7 +129,7 @@ static bool ProcessDeflate( const char *outfilename, const int nslices, const
assert( header.val2[1] == 1280 );
uLongf destLen = buf_size; // >= 608,427
Bytef *dest = (Bytef*)&outbuf[0];
Bytef *dest = (Bytef*)outbuf.data();
assert( is.tellg() == offsets[r] + 16 );
const Bytef *source = (const Bytef*)buf + offsets[r] + 16;
uLong sourceLen;
@ -143,7 +143,7 @@ static bool ProcessDeflate( const char *outfilename, const int nslices, const
assert( destLen >= (uLongf)size[0] * size[1] ); // 16bytes padding ?
assert( header.imgsize == (uint32_t)size[0] * size[1] );
//os.write( &outbuf[0], outbuf.size() );
os.write( &outbuf[0], size[0] * size[1] );
os.write( outbuf.data(), size[0] * size[1] );
// skip data:
is.seekg( sourceLen, std::ios::cur );
@ -211,7 +211,7 @@ static bool ProcessNone( const char *outfilename, const int nslices, const
ss << ".raw";
std::ofstream os( ss.str().c_str(), std::ios::binary );
outbuf.resize( buf_size ); // overallocated + 16
char *buffer = &outbuf[0];
char *buffer = outbuf.data();
hframe header;
for( unsigned int r = 0; r < nframes; ++r )

View File

@ -22,7 +22,6 @@
#include "gdcmBase64.h"
#include "gdcmExplicitDataElement.h"
#include "gdcmSwapper.h"
#include "gdcmPrinter.h"
#include <iostream>
#include <fstream>
@ -59,10 +58,10 @@ int main(int argc, char *argv[])
size_t dl = gdcm::Base64::GetDecodeLength( str.c_str(), str.size() );
std::vector<char> buf;
buf.resize( dl );
size_t dl2 = gdcm::Base64::Decode( &buf[0], buf.size(), str.c_str(), str.size() );
size_t dl2 = gdcm::Base64::Decode( buf.data(), buf.size(), str.c_str(), str.size() );
(void)dl2;
std::stringstream ss;
ss.str( std::string(&buf[0], buf.size()) );
ss.str( std::string(buf.data(), buf.size()) );
gdcm::File file;
gdcm::DataSet &ds2 = file.GetDataSet();
gdcm::DataElement xde;

View File

@ -43,7 +43,7 @@ static bool DumpToshibaDTI( const char * input, size_t len )
#else
std::istringstream is;
std::string dup( &copy[0], copy.size() );
std::string dup( copy.data(), copy.size() );
is.str( dup );
gdcm::File file;

View File

@ -43,7 +43,7 @@ static bool DumpToshibaDTI2( const char * input, size_t len )
#else
std::istringstream is;
std::string dup( &copy[0], copy.size() );
std::string dup( copy.data(), copy.size() );
is.str( dup );
gdcm::File file;

View File

@ -88,7 +88,7 @@ int main(int argc, char *argv[])
std::vector<char> vbuffer;
vbuffer.resize( totalLen );
char *buffer = &vbuffer[0];
char *buffer = vbuffer.data();
bv->GetBuffer(buffer, totalLen);
const unsigned char* pbyteCompressed0 = (const unsigned char*)buffer;
while( totalLen > 0 && pbyteCompressed0[totalLen-1] != 0xd9 )
@ -183,7 +183,7 @@ int main(int argc, char *argv[])
of.close();
#endif
const char *pbyteCompressed = &vbuffer[0];
const char *pbyteCompressed = vbuffer.data();
size_t cbyteCompressed = vbuffer.size(); // updated legnth
JlsParameters params;
@ -195,7 +195,7 @@ int main(int argc, char *argv[])
/ 8) * params.components);
CharlsApiResultType result =
JpegLsDecode(&rgbyteOut[0], rgbyteOut.size(), pbyteCompressed, cbyteCompressed, &params, errorMsg );
JpegLsDecode(rgbyteOut.data(), rgbyteOut.size(), pbyteCompressed, cbyteCompressed, &params, errorMsg );
if (result != charls::ApiResult::OK)
{
std::cerr << "Could not patch JAI-JPEGLS: " << errorMsg << std::endl;
@ -206,7 +206,7 @@ int main(int argc, char *argv[])
gdcm::DataElement pixeldata( gdcm::Tag(0x7fe0,0x0010) );
pixeldata.SetVR( gdcm::VR::OW );
pixeldata.SetByteValue( (char*)&rgbyteOutall[0], (uint32_t)rgbyteOutall.size() );
pixeldata.SetByteValue( (char*)rgbyteOutall.data(), (uint32_t)rgbyteOutall.size() );
// Add the pixel data element

View File

@ -77,7 +77,7 @@ int main(int argc, char *argv[])
DataSet &subds3 = item3.GetNestedDataSet();
const PrivateTag tseq6(0x7fe1,0x26,"GEMS_Ultrasound_MovieGroup_001");
if( !subds3.FindDataElement( tseq6 ) ) return 1;
if( !subds3.FindDataElement( tseq6 ) ) return true;
const DataElement& seq6 = subds3.GetDataElement( tseq6 );
SmartPointer<SequenceOfItems> sqi6 = seq6.GetValueAsSQ();
size_t ni6= sqi6->GetNumberOfItems();
@ -100,7 +100,7 @@ int main(int argc, char *argv[])
}
const PrivateTag tseq3(0x7fe1,0x36,"GEMS_Ultrasound_MovieGroup_001");
if( !subds3.FindDataElement( tseq3 ) ) return 1;
if( !subds3.FindDataElement( tseq3 ) ) return true;
const DataElement& seq3 = subds3.GetDataElement( tseq3 );
// std::cout << seq3 << std::endl;
@ -119,14 +119,14 @@ int main(int argc, char *argv[])
Item &item4 = sqi4->GetItem(i4);
DataSet &subds4 = item4.GetNestedDataSet();
if( !subds4.FindDataElement( tseq8 ) ) return 1;
if( !subds4.FindDataElement( tseq8 ) ) return true;
const DataElement& de8 = subds4.GetDataElement( tseq8 );
Element<VR::UL,VM::VM1> ldimz;
ldimz.SetFromDataElement( de8 );
dimz += ldimz.GetValue();
if( !subds4.FindDataElement( tseq4 ) ) return 1;
if( !subds4.FindDataElement( tseq4 ) ) return true;
const DataElement& seq4 = subds4.GetDataElement( tseq4 );
if( !subds4.FindDataElement( tseq5 ) ) return 1;
if( !subds4.FindDataElement( tseq5 ) ) return true;
const DataElement& seq5 = subds4.GetDataElement( tseq5 );
// std::cout << seq4 << std::endl;
@ -154,7 +154,7 @@ int main(int argc, char *argv[])
imbuffer.insert( imbuffer.begin(), bv5->GetPointer(), bv5->GetPointer() + bv5->GetLength() );
}
DataElement fakedata;
fakedata.SetByteValue( &imbuffer[0], (uint32_t)imbuffer.size() );
fakedata.SetByteValue( imbuffer.data(), (uint32_t)imbuffer.size() );
gdcm::SmartPointer<gdcm::Image> im = new gdcm::Image;

View File

@ -140,7 +140,7 @@ int main(int argc, char *argv[])
for( unsigned int i = 0; i < niter; ++i)
{
//bool b =
interpolate(&out[0], out.size() / 3, out2);
interpolate(out.data(), out.size() / 3, out2);
//const double *pout = &out[0];
out = out2;
out2.clear();
@ -149,7 +149,7 @@ int main(int argc, char *argv[])
gdcm::Attribute<0x3006,0x0050> at_interpolate;
at_interpolate.SetNumberOfValues( (unsigned int)(out.size() / 3) );
at_interpolate.SetValues( &out[0], (uint32_t)out.size() );
at_interpolate.SetValues( out.data(), (uint32_t)out.size() );
ncontourpoints.SetValue( at_interpolate.GetNumberOfValues() / 3 );
nestedds2.Replace( at_interpolate.GetAsDataElement() );

View File

@ -11,12 +11,11 @@
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "gdcmReader.h"
#include "gdcmImplicitDataElement.h"
#include "gdcmDataSet.h"
#include "gdcmPrivateTag.h"
#include "gdcmPrivateTag.h"
#include "gdcmByteValue.h"
#include "gdcmDataSet.h"
#include "gdcmImplicitDataElement.h"
#include "gdcmPrivateTag.h"
#include "gdcmReader.h"
#include "gdcmSequenceOfItems.h"
using namespace gdcm;

View File

@ -100,7 +100,7 @@ int main(int argc, char *argv[])
}
gdcm::Directory d;
d.Load( dir1.c_str(), true ); // recursive !
d.Load( dir1, true ); // recursive !
const gdcm::Directory::FilenamesType &l1 = d.GetFilenames();
const size_t nfiles = l1.size();
std::cout << nfiles << std::endl;

View File

@ -55,7 +55,7 @@ void delta_decode(const unsigned char *data_in, size_t data_size,
};
const byte* src = (const byte*)data_in;
byte* dest = (byte*)&new_stream[0];
byte* dest = (byte*)new_stream.data();
union { byte gray; byte rgb[3]; } pixel;
pixel.rgb[0] = pixel.rgb[1] = pixel.rgb[2] = 0;
// always start in grayscale mode
@ -222,7 +222,7 @@ int main(int argc, char *argv [])
gdcm::DataElement pixeldata( gdcm::Tag(0x7fe0,0x0010) );
pixeldata.SetVR( gdcm::VR::OW );
pixeldata.SetByteValue( (char*)&buffer[0], (uint32_t)buffer.size() );
pixeldata.SetByteValue( (char*)buffer.data(), (uint32_t)buffer.size() );
// TODO we should check that decompress byte buffer match the expected size (row*col*...)
// Add the pixel data element

View File

@ -180,7 +180,7 @@ int main(int argc, char *argv [])
{
std::vector<unsigned short> buffer;
delta_decode(bv2->GetPointer(), bv2->GetLength(), buffer);
pixeldata.SetByteValue( (char*)&buffer[0], (uint32_t)(buffer.size() * sizeof( unsigned short )) );
pixeldata.SetByteValue( (char*)buffer.data(), (uint32_t)(buffer.size() * sizeof( unsigned short )) );
}
// TODO we should check that decompress byte buffer match the expected size (row*col*...)

View File

@ -62,7 +62,7 @@ CHECK_CXX_SOURCE_COMPILES(
"int main() { const char *f = __FUNCTION__; return 0;}"
GDCM_CXX_HAS_FUNCTION)
CHECK_CXX_SOURCE_COMPILES(
"\#include <fstream>\nint main() { const wchar_t fn[10] = {}; std::ifstream is( fn ); return 0;}"
"\#include <fstream>\nint main() { const wchar_t fn[10] = {}; std::ifstream is( fn ); std::wcerr << fn; return 0;}"
GDCM_HAVE_WCHAR_IFSTREAM)
CHECK_CXX_SOURCE_COMPILES(
"\#include <string>\n#include <codecvt>\n#include <locale>\nint main() { std::u16string u16; std::string utf8 = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>{}.to_bytes(u16); }"

View File

@ -14,7 +14,7 @@
#include "gdcmASN1.h"
#include "gdcmSystem.h"
#include <string.h>
#include <cstring>
#ifdef GDCM_USE_SYSTEM_OPENSSL
#include <openssl/bio.h>

View File

@ -12,7 +12,7 @@
=========================================================================*/
#include "gdcmBase64.h"
#include <string.h> // memcpy
#include <cstring> // memcpy
#include <iostream>
namespace gdcm

View File

@ -14,11 +14,11 @@
#include "gdcmDirectory.h"
#include "gdcmTrace.h"
#include <cassert>
#include <cerrno>
#include <cstring> // strerror
#include <iterator>
#include <assert.h>
#include <errno.h>
#include <sys/stat.h> //stat function
#include <string.h> // strerror
#ifdef _MSC_VER
#include <windows.h>

View File

@ -49,7 +49,7 @@ public :
};
/// Generic inserter operator for Event and its subclasses.
inline std::ostream& operator<<(std::ostream& os, Event &e)
inline std::ostream& operator<<(std::ostream& os, const Event &e)
{
e.Print(os);
return os;
@ -71,7 +71,7 @@ inline std::ostream& operator<<(std::ostream& os, Event &e)
{ return dynamic_cast<const Self*>(e) ? true : false; } \
virtual ::gdcm::Event* MakeObject() const override \
{ return new Self; } \
classname(const Self&s) : super(s){}; \
classname(const Self&s) : super(s){} \
private: \
void operator=(const Self&); \
}

View File

@ -34,7 +34,7 @@ public:
FileNameEvent(const char *s = ""):m_FileName(s) {}
~FileNameEvent() override = default;
FileNameEvent(const Self&s) : AnyEvent(s){};
FileNameEvent(const Self&s) : AnyEvent(s){}
void operator=(const Self&) = delete;

View File

@ -12,10 +12,10 @@
=========================================================================*/
#include "gdcmFilename.h"
#include <limits.h>
#include <stdlib.h> // realpath
#include <assert.h>
#include <string.h>
#include <cassert>
#include <climits>
#include <cstdlib> // realpath
#include <cstring>
namespace gdcm
{
@ -28,7 +28,7 @@ const char *Filename::GetPath()
{
std::string fn = ToUnixSlashes();
std::string::size_type slash_pos = fn.rfind("/");
std::string::size_type slash_pos = fn.rfind('/');
if(slash_pos != std::string::npos)
{
Path = fn.substr(0, slash_pos);
@ -52,14 +52,14 @@ const char *Filename::GetName()
#if defined(_WIN32)
std::string::size_type slash_pos = filename.find_last_of("/\\");
#else
std::string::size_type slash_pos = filename.find_last_of("/");
std::string::size_type slash_pos = filename.find_last_of('/');
#endif
if(slash_pos != std::string::npos)
{
return &FileName[0] + slash_pos + 1;
return FileName.data() + slash_pos + 1;
}
return &FileName[0];
return FileName.data();
}
const char *Filename::ToWindowsSlashes()
@ -142,7 +142,7 @@ inline void Realpath(const char *path, std::string & resolved_path)
const char *Filename::GetExtension()
{
std::string name = GetName();
std::string::size_type dot_pos = name.rfind(".");
std::string::size_type dot_pos = name.rfind('.');
if(dot_pos != std::string::npos)
{
return GetName() + dot_pos;

View File

@ -19,9 +19,9 @@
#elif defined(GDCM_BUILD_TESTING)
#include "gdcm_md5.h"
#endif
#include <cstdio>
#include <fstream>
#include <vector>
#include <stdio.h>
#if defined(_MSC_VER) && (_MSC_VER < 1900)
#define snprintf _snprintf
#endif
@ -94,7 +94,7 @@ static bool process_file(const char *filename, md5_byte_t *digest)
const size_t file_size = System::FileSize(filename);
std::vector<char> v( file_size );
char *buffer = &v[0];
char *buffer = v.data();
file.read(buffer, file_size);
md5_state_t state;

View File

@ -18,9 +18,9 @@
#include <openssl/sha.h>
#endif
#include <string.h> // memcmp
#include <stdlib.h> // malloc
#include <stdio.h> // snprintf
#include <cstdio> // snprintf
#include <cstdlib> // malloc
#include <cstring> // memcmp
/*
*/

View File

@ -200,7 +200,7 @@ PrintObservers(std::ostream& os, std::string indent) const
{
const Event * e = (*i)->m_Event;
const Command* c = (*i)->m_Command; (void)c;
os << indent << e->GetEventName() << "(" /*<< c->GetNameOfClass()*/ << ")\n";
os << indent << e->GetEventName() << "(" /* << c->GetNameOfClass() */ << ")\n";
}
return true;
}

View File

@ -12,7 +12,7 @@
=========================================================================*/
#include "gdcmSwapCode.h"
#include <assert.h>
#include <cassert>
namespace gdcm
{

View File

@ -22,7 +22,6 @@ namespace gdcm
/**
* \brief SwapCode representation
* \details
*/
class GDCM_EXPORT SwapCode
{

View File

@ -20,23 +20,22 @@
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <string.h> // strspn
#include <assert.h>
#include <errno.h>
#include <cassert>
#include <cerrno>
#include <climits> // PATH_MAX
#include <cstdio> // snprintf
#include <cstdlib>
#include <cstring> // strspn
#include <sys/stat.h>
#include <limits.h> // PATH_MAX
// gettimeofday
#ifdef GDCM_HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <time.h>
#include <ctime>
#ifdef GDCM_HAVE_WINSOCK_H
#include <winsock.h>
#endif
#include <cstdio> // snprintf
#if defined(_MSC_VER) && (_MSC_VER < 1900)
#define snprintf _snprintf
#endif
@ -229,7 +228,7 @@ bool System::FileIsDirectory(const char* name)
if(stat(name, &fs) == 0)
#endif
{
#if _WIN32
#ifdef _WIN32
return ((fs.st_mode & _S_IFDIR) != 0);
#else
return S_ISDIR(fs.st_mode);
@ -461,10 +460,6 @@ std::wstring System::ConvertToUNC(const char *utf8path)
#endif
}
#ifndef PATH_MAX
#define PATH_MAX 4096
#endif
// return size of file; also returns zero if no file exists
size_t System::FileSize(const char* filename)
{
@ -611,10 +606,10 @@ const char *System::GetCurrentResourcesDirectory()
*/
inline int getlastdigit(unsigned char *data, unsigned long size)
{
int extended, carry = 0;
int carry = 0;
for(unsigned int i=0;i<size;i++)
{
extended = (carry << 8) + data[i];
int extended = (carry << 8) + data[i];
data[i] = (unsigned char)(extended / 10);
carry = extended % 10;
}
@ -625,14 +620,13 @@ inline int getlastdigit(unsigned char *data, unsigned long size)
size_t System::EncodeBytes(char *out, const unsigned char *data, int size)
{
bool zero = false;
int res;
std::string sres;
unsigned char buffer[32];
unsigned char *addr = buffer;
memcpy(addr, data, size);
while(!zero)
{
res = getlastdigit(addr, size);
int res = getlastdigit(addr, size);
const char v = (char)('0' + res);
sres.insert(sres.begin(), v);
zero = true;
@ -964,7 +958,7 @@ bool System::GetHostName(char name[255])
{
// http://msdn.microsoft.com/en-us/library/ms738527.aspx
// WSANOTINITIALISED A successful WSAStartup call must occur before using this function.
#if _WIN32
#ifdef _WIN32
// Get the hostname
WORD wVersionRequested;
WSADATA wsaData;

View File

@ -13,10 +13,9 @@
=========================================================================*/
#include "gdcmTerminal.h"
#include <iostream>
#include <iostream>
#include <cstdio>
#include <fstream>
#include <stdio.h>
#include <iostream>
#if defined(_MSC_VER) && (_MSC_VER < 1900)
#define snprintf _snprintf
#endif

View File

@ -16,8 +16,8 @@
#include "gdcmSystem.h"
#include "gdcmMD5.h"
#include <string.h> // strcmp
#include <stdlib.h> // malloc
#include <cstdlib> // malloc
#include <cstring> // strcmp
namespace gdcm
@ -27,14 +27,14 @@ namespace gdcm
#error how did that happen ?
#endif
#include "gdcmDataFileNames.cxx"
#include "gdcmMD5DataImages.cxx"
#include "gdcmMD5DataBrokenImages.cxx"
#include "gdcmMediaStorageDataFiles.cxx"
#include "gdcmStreamOffsetDataFiles.cxx"
#include "gdcmDataFileNames.cxx" // NOLINT(bugprone-suspicious-include)
#include "gdcmMD5DataImages.cxx" // NOLINT(bugprone-suspicious-include)
#include "gdcmMD5DataBrokenImages.cxx" // NOLINT(bugprone-suspicious-include)
#include "gdcmMediaStorageDataFiles.cxx" // NOLINT(bugprone-suspicious-include)
#include "gdcmStreamOffsetDataFiles.cxx" // NOLINT(bugprone-suspicious-include)
// After gdcmStreamOffsetDataFiles:
#include "gdcmSelectedTagsOffsetDataFiles.cxx"
#include "gdcmSelectedPrivateGroupOffsetDataFiles.cxx"
#include "gdcmSelectedTagsOffsetDataFiles.cxx" // NOLINT(bugprone-suspicious-include)
#include "gdcmSelectedPrivateGroupOffsetDataFiles.cxx" // NOLINT(bugprone-suspicious-include)
bool Testing::ComputeMD5(const char *buffer, size_t buf_len,
char digest_str[33])

View File

@ -31,8 +31,8 @@ namespace gdcm
class GDCM_EXPORT Testing
{
public :
Testing() = default;;
~Testing() = default;;
Testing() = default;
~Testing() = default;
/// MD5 stuff
/// digest_str needs to be at least : strlen = [2*16+1];

View File

@ -23,13 +23,12 @@ bool Unpacker12Bits::Unpack(char *out, const char *in, size_t n)
short *q = (short*)(void*)out;
const unsigned char *p = (const unsigned char*)in;
const unsigned char *end = p+n;
unsigned char b0,b1,b2;
while (p!=end)
{
b0 = *p++;
b1 = *p++;
b2 = *p++;
unsigned char b0 = *p++;
unsigned char b1 = *p++;
unsigned char b2 = *p++;
*q++ = (short)(((b1 & 0xf) << 8) + b0);
*q++ = (short)((b1>>4) + (b2<<4));
}
@ -42,12 +41,11 @@ bool Unpacker12Bits::Pack(char *out, const char *in, size_t n)
unsigned char *q = (unsigned char*)out;
const unsigned short *p = (const unsigned short*)(const void*)in;
const unsigned short *end = (const unsigned short*)(const void*)(in+n);
unsigned short b0,b1;
while(p!=end)
{
b0 = *p++;
b1 = *p++;
unsigned short b0 = *p++;
unsigned short b1 = *p++;
*q++ = (unsigned char)(b0 & 0xff);
*q++ = (unsigned char)((b0 >> 8) + ((b1 & 0xf) << 4));

View File

@ -20,10 +20,10 @@ namespace gdcm
{
/**
* \brief Pack/Unpack 12 bits pixel into 16bits
* \details
* \li You can only pack an even number of 16bits, which means a multiple of 4 (expressed in bytes)
* \li You can only unpack a multiple of 3 bytes
*
* \details
* This class has no purpose in general purpose DICOM implementation. However
* to be able to cope with some early ACR-NEMA file generated by a well-known
* private vendor, one would need to unpack 12bits Stored Pixel Value into a

View File

@ -143,9 +143,7 @@ basic_zip_streambuf<charT, traits>::overflow(int_type c)
template <class charT, class traits>
std::streamsize basic_zip_streambuf<charT, traits>::flush()
{
std::streamsize written_byte_size = 0, total_written_byte_size = 0;
size_t remainder = 0;
std::streamsize total_written_byte_size = 0;
// updating crc
_crc = crc32(_crc, _zip_stream.next_in,
@ -156,14 +154,15 @@ std::streamsize basic_zip_streambuf<charT, traits>::flush()
_err = deflate(&_zip_stream, Z_FINISH);
if(_err == Z_OK || _err == Z_STREAM_END)
{
written_byte_size = static_cast<std::streamsize>(_output_buffer.size()) - _zip_stream.avail_out;
std::streamsize written_byte_size = static_cast<std::streamsize>(_output_buffer.size()) - _zip_stream.avail_out;
total_written_byte_size += written_byte_size;
// output buffer is full, dumping to ostream
_ostream.write( (const char_type*) &(_output_buffer[0]),
static_cast<std::streamsize>(written_byte_size/sizeof(char_type)*sizeof(char)));
// checking if some bytes were not written.
if((remainder = written_byte_size%sizeof(char_type)) != 0)
size_t remainder = written_byte_size%sizeof(char_type);
if(remainder != 0)
{
// copy to the beginning of the stream
std::streamsize theDiff = written_byte_size-remainder;
@ -242,13 +241,12 @@ bool basic_zip_streambuf<charT, traits>::zip_to_stream(
char_type *buffer,
std::streamsize buffer_size)
{
std::streamsize written_byte_size = 0, total_written_byte_size = 0;
std::streamsize total_written_byte_size = 0;
_zip_stream.next_in = (byte_buffer_type) buffer;
_zip_stream.avail_in = static_cast<uInt>(buffer_size * sizeof(char_type));
_zip_stream.avail_out = static_cast<uInt>(_output_buffer.size());
_zip_stream.next_out = &_output_buffer[0];
size_t remainder = 0;
// updating crc
_crc = crc32(_crc, _zip_stream.next_in,
@ -260,7 +258,7 @@ bool basic_zip_streambuf<charT, traits>::zip_to_stream(
if (_err == Z_OK || _err == Z_STREAM_END)
{
written_byte_size= static_cast<std::streamsize>(_output_buffer.size()) -
std::streamsize written_byte_size = static_cast<std::streamsize>(_output_buffer.size()) -
_zip_stream.avail_out;
total_written_byte_size += written_byte_size;
// output buffer is full, dumping to ostream
@ -269,7 +267,8 @@ bool basic_zip_streambuf<charT, traits>::zip_to_stream(
static_cast<std::streamsize>(written_byte_size / sizeof(char_type)));
// checking if some bytes were not written.
if((remainder = written_byte_size % sizeof(char_type)) != 0)
size_t remainder = written_byte_size % sizeof(char_type);
if(remainder != 0)
{
// copy to the beginning of the stream
std::streamsize theDiff = written_byte_size-remainder;
@ -285,6 +284,8 @@ bool basic_zip_streambuf<charT, traits>::zip_to_stream(
}
while(_zip_stream.avail_in != 0 && _err == Z_OK);
(void)total_written_byte_size;
return _err == Z_OK;
}

View File

@ -16,8 +16,8 @@
#include "gdcmDefs.h"
#include "gdcmFilename.h"
#include <limits.h> // PATH_MAX
#include <string.h> // strcpy
#include <climits> // PATH_MAX
#include <cstring> // strcpy
#ifdef _WIN32
#include <windows.h> // MAX_PATH
#endif
@ -27,7 +27,7 @@ namespace gdcm
// Must NOT be initialized. Default initialization to zero is
// necessary.
unsigned int GlobalCount;
static unsigned int GlobalCount;
class GlobalInternal
{
@ -138,10 +138,6 @@ bool Global::Prepend(const char *path)
#define PATH_MAX 4096
#endif
#ifndef PATH_MAX
#define PATH_MAX 4096
#endif
const char *Global::Locate(const char *resfile) const
{
#ifdef _WIN32

View File

@ -1241,7 +1241,7 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x0021,0x0048,"SIEMENS MR SDS 01",VR::CS,VM::VM1,"??",false},
{0x0021,0x0049,"SIEMENS MR SDI 02",VR::IS,VM::VM1,"??",false},
{0x0021,0x0049,"SIEMENS MR SDS 01",VR::CS,VM::VM1,"??",false},
{0x0021,0x004e,"SIEMENS MR SDI 02",VR::IS,VM::VM1,"??",false},
{0x0021,0x004e,"SIEMENS MR SDI 02",VR::IS,VM::VM1,"Actual 3D Ima Part Number",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},

View File

@ -16,7 +16,7 @@
=========================================================================*/
#include "gdcmUIDs.h"
#include <string.h> // strcmp
#include <cstring> // strcmp
namespace gdcm
{

View File

@ -44,7 +44,6 @@ public:
std::istream &Read(std::istream &is) {
// Superclass
const Tag itemStart(0xfffe, 0xe000);
const Tag seqDelItem(0xfffe,0xe0dd);
if( !TagField.Read<TSwap>(is) )
{
assert(0 && "Should not happen");

View File

@ -27,8 +27,6 @@ namespace gdcm
//{
//}
//-----------------------------------------------------------------------------
ByteSwapFilter::~ByteSwapFilter()
= default;
bool ByteSwapFilter::ByteSwap()
{

View File

@ -28,7 +28,7 @@ class GDCM_EXPORT ByteSwapFilter
{
public:
ByteSwapFilter(DataSet& ds):DS(ds),ByteSwapTag(false) {}
~ByteSwapFilter();
~ByteSwapFilter() = default;
ByteSwapFilter(const ByteSwapFilter &) = delete;
ByteSwapFilter& operator=(const ByteSwapFilter &) = delete;

View File

@ -95,7 +95,7 @@ namespace gdcm_ns
// so we need an inequality
if( length <= Internal.size() )
{
if(!Internal.empty()) memcpy(buffer, &Internal[0], length);
if(!Internal.empty()) memcpy(buffer, Internal.data(), length);
return true;
}
gdcmDebugMacro( "Could not handle length= " << length );

View File

@ -30,7 +30,6 @@ using namespace gdcm;
#endif
/**
* \brief Class to represent binary value (array of bytes)
* \note
*/
class GDCM_EXPORT ByteValue : public Value
{

View File

@ -21,7 +21,6 @@ namespace gdcm
// Data Element (CP246Explicit)
/**
* \brief Class to read/write a DataElement as CP246Explicit Data Element
* \details
* \note Some system are producing SQ, declare them as UN, but encode the SQ as 'Explicit'
* instead of Implicit
*/

View File

@ -993,7 +993,7 @@ bool CSAHeader::LoadFromDataElement(DataElement const &de)
// Some silly software consider the tag to be OW, therefore they byteswap it !!! sigh
if( strcmp( signature, "VS01" ) == 0 )
{
SwapperDoOp::SwapArray( (unsigned short*)(void*)&s[0], (s.size() + 1) / 2 );
SwapperDoOp::SwapArray( (unsigned short*)(void*)s.data(), (s.size() + 1) / 2 );
ss.str( s );
ss.read(signature, 4);
}
@ -1168,7 +1168,7 @@ bool CSAHeader::LoadFromDataElement(DataElement const &de)
}
std::string str = os.str();
if( !str.empty() )
csael.SetByteValue( &str[0], (uint32_t)str.size());
csael.SetByteValue( str.data(), (uint32_t)str.size());
//std::cout << std::endl;
InternalCSADataSet.insert( csael );
}

View File

@ -64,7 +64,7 @@ class GDCM_EXPORT CSAHeader
{
friend std::ostream& operator<<(std::ostream &_os, const CSAHeader &d);
public :
CSAHeader():InternalDataSet(),InternalType(UNKNOWN),InterfileData(nullptr) {};
CSAHeader():InternalDataSet(),InternalType(UNKNOWN),InterfileData(nullptr) {}
~CSAHeader() = default;
/// Diverse format of CSAHeader as found 'in the wild'

View File

@ -49,7 +49,7 @@ std::string DataSet::GetPrivateCreator(const Tag &t) const
// osirix/AbdominalCT/36382443
owner.erase(owner.size()-1,1);
}
assert( owner.size() == 0 || owner[owner.size()-1] != ' ' );
assert( owner.empty() || owner[owner.size()-1] != ' ' );
return owner;
}
}
@ -85,7 +85,7 @@ Tag DataSet::ComputeDataElement(const PrivateTag & t) const
std::string tmp(bv->GetPointer(),bv->GetLength());
// trim trailing whitespaces:
tmp.erase(tmp.find_last_not_of(' ') + 1);
assert( tmp.size() == 0 || tmp[ tmp.size() - 1 ] != ' ' ); // FIXME
assert( tmp.empty() || tmp[ tmp.size() - 1 ] != ' ' ); // FIXME
if( System::StrCaseCmp( tmp.c_str(), refowner ) == 0 )
{
// found !

View File

@ -229,7 +229,7 @@ public:
}
/// Returns if the dataset is empty
bool IsEmpty() const { return DES.empty(); };
bool IsEmpty() const { return DES.empty(); }
DataSet& operator=(DataSet const &)
= default;

View File

@ -23,8 +23,6 @@ namespace gdcm
/**
* \brief DataSetEvent
* \details Special type of event triggered during the DataSet store/move process
*
* \see
*/
class DataSetEvent : public AnyEvent
{
@ -40,7 +38,7 @@ public:
{ return (dynamic_cast<const Self*>(e) == nullptr ? false : true) ; }
::gdcm::Event* MakeObject() const override
{ return new Self; }
DataSetEvent(const Self&s) : AnyEvent(s){};
DataSetEvent(const Self&s) : AnyEvent(s){}
DataSet const & GetDataSet() const { return *m_DataSet; }
};

View File

@ -518,7 +518,7 @@ bool ReadImplicitDataElement(std::istream &is, ImplicitDataElement &de)
* Note: PS 3.5 specifies that Elements with Tags (0001,xxxx), (0003,xxxx),
* (0005,xxxx), and (0007,xxxx) shall not be used.
*/
/// \TODO FIXME
/// \todo FIXME
/// For now I do a Seek back of 6 bytes. It would be better to finish reading
/// the first element of the FMI so that I can read the group length and
/// therefore compare it against the actual value we found...

View File

@ -94,20 +94,9 @@ public:
static void SetSourceApplicationEntityTitle(const char * title);
static const char *GetSourceApplicationEntityTitle();
FileMetaInformation(FileMetaInformation const &fmi):DataSet(fmi)
{
DataSetTS = fmi.DataSetTS;
MetaInformationTS = fmi.MetaInformationTS;
DataSetMS = fmi.DataSetMS;
}
FileMetaInformation& operator=(const FileMetaInformation& fmi)
{
DataSetTS = fmi.DataSetTS;
MetaInformationTS = fmi.MetaInformationTS;
DataSetMS = fmi.DataSetMS;
return *this;
}
FileMetaInformation(FileMetaInformation const& fmi) = default;
FileMetaInformation& operator=(const FileMetaInformation& fmi) = default;
VL GetFullLength() const {
return P.GetLength() + DataSet::GetLength<ExplicitDataElement>();
}

View File

@ -20,7 +20,6 @@
namespace gdcm
{
/**
* \brief
* \details File-set: A File-set is a collection of DICOM Files (and possibly non-DICOM Files)
* that share a common naming space within which File IDs are unique.
*/

View File

@ -62,9 +62,6 @@ public:
template <typename TSwap>
std::istream &ReadPreValue(std::istream &is)
{
const Tag itemStart(0xfffe, 0xe000);
const Tag seqDelItem(0xfffe,0xe0dd);
TagField.Read<TSwap>(is);
if( !is )
{
@ -79,6 +76,8 @@ public:
throw Exception( "Problem #2" );
}
#ifdef GDCM_SUPPORT_BROKEN_IMPLEMENTATION
const Tag itemStart(0xfffe, 0xe000);
const Tag seqDelItem(0xfffe,0xe0dd);
if( TagField != itemStart && TagField != seqDelItem )
{
throw Exception( "Problem #3" );
@ -90,9 +89,6 @@ public:
template <typename TSwap>
std::istream &ReadValue(std::istream &is)
{
// Superclass
const Tag itemStart(0xfffe, 0xe000);
const Tag seqDelItem(0xfffe,0xe0dd);
// Self
SmartPointer<ByteValue> bv = new ByteValue;
bv->SetLength(ValueLengthField);

View File

@ -13,7 +13,7 @@
=========================================================================*/
#include "gdcmItem.h"
#include <assert.h>
#include <cassert>
namespace gdcm_ns
{

View File

@ -183,7 +183,7 @@ int PDBHeader::readprotocoldatablock(const char *input, size_t inputlen, bool ve
offset = 0;
len = (uint32_t)inputlen;
}
else
else
{
gdcmWarningMacro("Unhandled Protocol Data Block magic value: " << len );
return 1;

View File

@ -37,7 +37,7 @@ class ParseException : public Exception
{
public:
ParseException() = default;
~ParseException() throw() override {};
~ParseException() throw() override {}
/** Assignment operator. */
ParseException &operator= ( const ParseException &orig )

View File

@ -12,7 +12,7 @@
=========================================================================*/
#include "gdcmPreamble.h"
#include <string.h> // memset
#include <cstring> // memset
namespace gdcm
{

View File

@ -57,12 +57,13 @@ public:
/// Return size of Preamble
VL GetLength() const { return 128 + 4; }
Preamble(Preamble const &)
Preamble(Preamble const &):Internal(nullptr)
{
Create();
}
Preamble& operator=(Preamble const &)
{
Internal = nullptr;
Create();
return *this;
}

View File

@ -15,7 +15,7 @@
#include "gdcmTrace.h"
#include "gdcmSystem.h" // FIXME
#include <stdio.h> // sscanf
#include <cstdio> // sscanf
#include <limits> // numeric_limits
namespace gdcm_ns
@ -42,7 +42,7 @@ namespace gdcm_ns
SetElement( (uint8_t)element );
const char *owner = str + nchar;
SetOwner( owner );
const bool hasBackslash = strchr(owner,'\\') != NULL;
const bool hasBackslash = strchr(owner,'\\') != nullptr;
const char * creator = GetOwner();
if( !*creator || hasBackslash )
{

View File

@ -60,8 +60,8 @@ Reader::~Reader()
/// (i.e. the file is a 'true dicom' one)
/// If not found then seek back at beginning of file (could be Mallinckrodt
/// or old ACRNEMA with no preamble)
/// \precondition we are at the beginning of file
/// \postcondition we are at the beginning of the DataSet or
/// \pre we are at the beginning of file
/// \post we are at the beginning of the DataSet or
/// Meta Information Header
bool Reader::ReadPreamble()
{
@ -70,8 +70,8 @@ bool Reader::ReadPreamble()
/// \brief read the DICOM Meta Information Header
/// Find out the TransferSyntax used (default: Little Endian Explicit)
/// \precondition we are at the start of group 0x0002 (well after preamble)
/// \postcondition we are at the beginning of the DataSet
/// \pre we are at the start of group 0x0002 (well after preamble)
/// \post we are at the beginning of the DataSet
bool Reader::ReadMetaInformation()
{
return true;
@ -831,7 +831,7 @@ bool Reader::CanRead() const
void Reader::SetFileName(const char *utf8path)
{
if(Ifstream) delete Ifstream;
delete Ifstream;
Ifstream = new std::ifstream();
if (utf8path && *utf8path) {
#ifdef _MSC_VER

View File

@ -128,6 +128,8 @@ bool SequenceOfFragments::WriteBuffer(std::ostream &os) const
// assert(0);
// return false;
// }
(void)total;
return true;
}
@ -142,7 +144,7 @@ bool SequenceOfFragments::FillFragmentWithJPEG( Fragment & frag, std::istream &
if( byte == 0xd9 && jfif[ jfif.size() - 2 ] == 0xff ) break;
}
const uint32_t len = static_cast<uint32_t>(jfif.size());
frag.SetByteValue( (char*)&jfif[0], len );
frag.SetByteValue( (char*)jfif.data(), len );
return true;
}

View File

@ -82,7 +82,7 @@ public:
/// Index starts at 1 not 0
bool RemoveItemByIndex( const SizeType index );
bool IsEmpty() const { return Items.empty(); };
bool IsEmpty() const { return Items.empty(); }
SizeType GetNumberOfItems() const { return Items.size(); }
void SetNumberOfItems(SizeType n) { Items.resize(n); }

View File

@ -14,7 +14,7 @@
#include "gdcmTag.h"
#include "gdcmTrace.h"
#include <stdio.h> // sscanf
#include <cstdio> // sscanf
namespace gdcm
{

View File

@ -14,8 +14,8 @@
#include "gdcmTransferSyntax.h"
#include "gdcmTrace.h"
#include <assert.h>
#include <string.h>
#include <cassert>
#include <cstring>
#include <string>
#include <iostream>
@ -90,7 +90,7 @@ TransferSyntax::TSType TransferSyntax::GetTSType(const char *cstr)
{
// trim trailing whitespace
std::string str = cstr;
std::string::size_type notspace = str.find_last_not_of(" ") + 1;
std::string::size_type notspace = str.find_last_not_of(' ') + 1;
if( notspace != str.size() )
{
gdcmDebugMacro( "BUGGY HEADER: TS contains " <<

View File

@ -12,9 +12,9 @@
=========================================================================*/
#include "gdcmVM.h"
#include <assert.h>
#include <stdlib.h> // abort
#include <string.h> // strcmp
#include <cassert>
#include <cstdlib> // abort
#include <cstring> // strcmp
namespace gdcm
{

View File

@ -13,8 +13,8 @@
=========================================================================*/
#include "gdcmVR.h"
#include <algorithm> // for std::lower_bound
#include <string.h>
#include <assert.h>
#include <cassert>
#include <cstring>
namespace gdcm
{

View File

@ -16,13 +16,11 @@
#include "gdcmDataSet.h"
#include "gdcmTrace.h"
#include "gdcmSwapper.h"
#include "gdcmDataSet.h"
#include "gdcmExplicitDataElement.h"
#include "gdcmImplicitDataElement.h"
#include "gdcmSwapper.h"
#include "gdcmValue.h"
#include "gdcmValue.h"
#include "gdcmItem.h"
#include "gdcmSequenceOfItems.h"
#include "gdcmParseException.h"

View File

@ -18,7 +18,7 @@
#include "gdcmTrace.h"
#include "gdcmFile.h"
#include <stdlib.h>
#include <cstdlib>
namespace gdcm
{

View File

@ -13,7 +13,7 @@
=========================================================================*/
#include "gdcmIODEntry.h"
#include <stdlib.h> // abort
#include <cstdlib> // abort
namespace gdcm
{

View File

@ -18,8 +18,8 @@
#include <fstream>
#include "gdcm_expat.h"
#include <stdio.h> // for stderr
#include <string.h>
#include <cstdio> // for stderr
#include <cstring>
namespace gdcm
{
@ -73,7 +73,7 @@ void TableReader::HandleMacroEntryDescription(const char **atts)
assert( ParsingMacroEntryDescription == false );
ParsingMacroEntryDescription = true;
assert( *atts == nullptr );
assert( Description == "" );
assert( Description.empty() );
}
void TableReader::HandleModuleInclude(const char **atts)
@ -92,7 +92,7 @@ void TableReader::HandleModuleEntryDescription(const char **atts)
assert( ParsingModuleEntryDescription == false );
ParsingModuleEntryDescription = true;
assert( *atts == nullptr );
assert( Description == "" );
assert( Description.empty() );
}
void TableReader::HandleMacroEntry(const char **atts)

View File

@ -12,7 +12,7 @@
=========================================================================*/
#include "gdcmType.h"
#include <string.h>
#include <cstring>
namespace gdcm
{

View File

@ -12,7 +12,7 @@
=========================================================================*/
#include "gdcmUsage.h"
#include <string.h>
#include <cstring>
namespace gdcm
{

View File

@ -1,28 +0,0 @@
ISO_IR 100 : 28591 : Latin Alphabet No. 1 Unextended
ISO_IR 101 : 28592 : Latin Alphabet No. 2 Unextended
ISO_IR 109 : 28593 : Latin Alphabet No. 3 Unextended
ISO_IR 110 : 28594 : Latin Alphabet No. 4 Unextended
ISO_IR 144 : 28595 : Cyrillic Unextended
ISO_IR 127 : 28596 : Arabic Unextended
ISO_IR 126 : 28597 : Greek Unextended
ISO_IR 138 : 28598 : Hebrew Unextended
ISO_IR 148 : 28599 : Latin Alphabet No. 5 (Turkish) Unextended
ISO_IR 13 : 932 : JIS X 0201 (Shift JIS) Unextended
ISO_IR 166 : 874 : TIS 620-2533 (Thai) Unextended
ISO_IR 192 : 65001 : Unicode in UTF-8
ISO 2022 IR 6 : 28591 : Default
ISO 2022 IR 100 : 28591 : Latin Alphabet No. 1 Extended
ISO 2022 IR 101 : 28592 : Latin Alphabet No. 2 Extended
ISO 2022 IR 109 : 28593 : Latin Alphabet No. 3 Extended
ISO 2022 IR 110 : 28594 : Latin Alphabet No. 4 Extended
ISO 2022 IR 144 : 28595 : Cyrillic Extended
ISO 2022 IR 127 : 28596 : Arabic Extended
ISO 2022 IR 126 : 28597 : Greek Extended
ISO 2022 IR 138 : 28598 : Hebrew Extended
ISO 2022 IR 148 : 28599 : Latin Alphabet No. 5 (Turkish) Extended
ISO 2022 IR 13 : 50222 : JIS X 0201 (Shift JIS) Extended
ISO 2022 IR 166 : 874 : TIS 620-2533 (Thai) Extended
ISO 2022 IR 87 : 50222 : JIS X 0208 (Kanji) Extended
ISO 2022 IR 159 : 50222 : JIS X 0212 (Kanji) Extended
ISO 2022 IR 149 : 20949 : KS X 1001 (Hangul and Hanja) Extended
GB18030 : 54936 : Chinese (Simplified) Extended

View File

@ -33,7 +33,7 @@ public:
typedef AnyEvent Superclass;
AnonymizeEvent(Tag const &tag = 0):m_Tag(tag) {}
~AnonymizeEvent() override = default;
AnonymizeEvent(const Self&s) : AnyEvent(s){};
AnonymizeEvent(const Self&s) : AnyEvent(s){}
void operator=(const Self&) = delete;
const char * GetEventName() const override { return "AnonymizeEvent"; }

View File

@ -971,7 +971,7 @@ bool Anonymizer::BALCPProtect(DataSet &ds, Tag const & tag, IOD const & iod)
if ( IsVRUI( tag ) )
{
std::string UIDToAnonymize = "";
std::string UIDToAnonymize;
UIDGenerator uid;
if( !copy.IsEmpty() )
@ -982,7 +982,7 @@ bool Anonymizer::BALCPProtect(DataSet &ds, Tag const & tag, IOD const & iod)
}
}
std::string anonymizedUID = "";
std::string anonymizedUID;
if( !UIDToAnonymize.empty() )
{
if ( dummyMapUIDTags.count( UIDToAnonymize ) == 0 )

View File

@ -83,7 +83,7 @@ void Bitmap::SetNumberOfDimensions(unsigned int dim)
const unsigned int *Bitmap::GetDimensions() const
{
assert( NumberOfDimensions );
return &Dimensions[0];
return Dimensions.data();
}
unsigned int Bitmap::GetDimension(unsigned int idx) const
@ -1006,7 +1006,6 @@ bool Bitmap::GetBufferInternal(char *buffer, bool &lossyflag) const
//if( !success ) success = TryDeltaEncodingCodec(buffer);
if( !success )
{
buffer = nullptr;
//throw Exception( "No codec found for this image");
}
@ -1023,7 +1022,6 @@ bool Bitmap::GetBuffer2(std::ostream &os) const
//if( !success ) success = TryRLECodec2(buffer);
if( !success )
{
//buffer = 0;
throw Exception( "No codec found for this image");
}
@ -1052,7 +1050,7 @@ void Bitmap::Print(std::ostream &os) const
if( !IsEmpty() )
{
os << "NumberOfDimensions: " << NumberOfDimensions << "\n";
assert( Dimensions.size() );
assert( !Dimensions.empty() );
os << "Dimensions: (";
std::vector<unsigned int>::const_iterator it = Dimensions.begin();
os << *it;

View File

@ -15,9 +15,9 @@
#include "gdcmImage.h"
#include <cstdlib> // abort
#include <cstring> // memcpy
#include <limits>
#include <stdlib.h> // abort
#include <string.h> // memcpy
namespace gdcm
{

View File

@ -634,7 +634,7 @@ struct Cleaner::impl {
return false;
}
bool Scrub(Tag const &t) { return false; }
bool Scrub(Tag const & /*t*/) { return false; }
bool Scrub(PrivateTag const &pt) {
static const PrivateTag &csa1 = CSAHeader::GetCSAImageHeaderInfoTag();
static const PrivateTag &csa2 = CSAHeader::GetCSASeriesHeaderInfoTag();
@ -655,7 +655,7 @@ struct Cleaner::impl {
return true;
}
bool Scrub(VR const &vr) { return false; }
bool Scrub(VR const & /*vr*/) { return false; }
bool Preserve(DPath const &dpath) {
preserve_dpaths.insert(dpath);
@ -665,7 +665,7 @@ struct Cleaner::impl {
void RemoveAllMissingPrivateCreator(bool remove) {
AllMissingPrivateCreator = remove;
}
bool RemoveMissingPrivateCreator(Tag const &t) { return false; }
bool RemoveMissingPrivateCreator(Tag const & /*t*/) { return false; }
void RemoveAllGroupLength(bool remove) { AllGroupLength = remove; }
void RemoveAllIllegal(bool remove) { AllIllegal = remove; }
};
@ -840,41 +840,6 @@ static inline bool bs_is_signature(const ByteValue *bv, const char *str) {
return false;
}
static inline bool is_signature_end(const ByteValue *bv, const char *str) {
const size_t len = strlen(str);
if (bv->GetLength() >= len &&
memcmp(bv->GetPointer() + bv->GetLength() - len, str, len) == 0) {
return true;
}
return false;
}
static inline bool bs_is_signature_end(const ByteValue *bv, const char *str) {
const size_t len = strlen(str);
if (bv->GetLength() >= len &&
bs_memcmp(bv->GetPointer() + bv->GetLength() - len, str, len) == 0) {
return true;
}
return false;
}
static inline bool isSV10Legacy(const ByteValue *bv) {
// 4 bytes aligned:
if (bv->GetLength() % 4 == 0) {
uint32_t n;
uint32_t unused;
if (bv->GetLength() >= 8) {
const char *buffer = bv->GetPointer();
memcpy(&n, buffer, 4);
memcpy(&unused, buffer + 4, 4);
if (n < 0x100 && unused == 0x4d) return true;
}
}
return false;
}
static bool CleanCSAImage(DataSet &ds, const DataElement &de) {
const ByteValue *bv = de.GetByteValue();
// fast path:
@ -888,19 +853,30 @@ static bool CleanCSAImage(DataSet &ds, const DataElement &de) {
CSAImageHeaderTypeStrings);
}
static const char sv10[] = "SV10\4\3\2\1"; // 8
// what if a dumb anonymizer removed the CSA Image Header Type:
bool isSV10 = false;
if (image_type == IMAGE_UNK) {
if (is_signature(bv, sv10)) {
if (!ref.empty()) {
gdcmWarningMacro(
"Please report. SV10 Header found for new type: " << ref);
}
isSV10 = true;
}
}
// easy case: recognized keywords:
if (image_type == IMAGE_NUM_4 // MR Image Storage / NUMARIS/4
|| image_type == IMAGE_MR // Enhanced SR Storage
|| image_type == NONIMAGE_NUM_4 // CSA Non-Image Storage
|| image_type == PET_NUM_4 // Positron Emission Tomography Image Storage
) {
|| isSV10) {
DataElement clean(de.GetTag());
clean.SetVR(de.GetVR());
std::vector<char> v;
v.resize(bv->GetLength());
if (csa_memcpy(&v[0], bv->GetPointer(), bv->GetLength())) {
clean.SetByteValue(&v[0], (uint32_t)v.size());
if (csa_memcpy(v.data(), bv->GetPointer(), bv->GetLength())) {
clean.SetByteValue(v.data(), (uint32_t)v.size());
ds.Replace(clean);
return true;
}
@ -918,10 +894,8 @@ static bool CleanCSAImage(DataSet &ds, const DataElement &de) {
// else
// add a dummy check for SV10 signature
if (is_signature(bv, sv10)) {
if (image_type == IMAGE_UNK) {
gdcmErrorMacro("Please report. SV10 Header found for new type: " << ref);
return false;
}
gdcmErrorMacro("Failure to clean SV10 Header for type: " << ref);
return false;
}
return true;
}
@ -939,15 +913,26 @@ static bool CleanCSASeries(DataSet &ds, const DataElement &de) {
CSASeriesHeaderTypeStrings);
}
static const char sv10[] = "SV10\4\3\2\1"; // 8
// what if a dumb anonymizer removed the CSA Series Header Type:
bool isSV10 = false;
if (series_type == SERIES_UNK) {
if (is_signature(bv, sv10)) {
if (!ref.empty()) {
gdcmWarningMacro(
"Please report. SV10 Header found for new type: " << ref);
}
isSV10 = true;
}
}
// easy case: recognized keywords:
if (series_type == PT || series_type == SERIES_MR) {
if (series_type == PT || series_type == SERIES_MR || isSV10) {
DataElement clean(de.GetTag());
clean.SetVR(de.GetVR());
std::vector<char> v;
v.resize(bv->GetLength());
if (csa_memcpy(&v[0], bv->GetPointer(), bv->GetLength())) {
clean.SetByteValue(&v[0], (uint32_t)v.size());
if (csa_memcpy(v.data(), bv->GetPointer(), bv->GetLength())) {
clean.SetByteValue(v.data(), (uint32_t)v.size());
ds.Replace(clean);
return true;
}
@ -965,10 +950,8 @@ static bool CleanCSASeries(DataSet &ds, const DataElement &de) {
// else
// add a dummy check for SV10 signature
if (is_signature(bv, sv10)) {
if (series_type == SERIES_UNK) {
gdcmErrorMacro("Please report. SV10 Header found for new type: " << ref);
return false;
}
gdcmErrorMacro("Failure to clean SV10 Header for type: " << ref);
return false;
}
return true;
}
@ -993,8 +976,8 @@ static bool CleanMEC_MR3(DataSet &ds, const DataElement &de) {
return true;
}
}
if (mec_mr3_memcpy(&v[0], bv->GetPointer(), bv->GetLength())) {
clean.SetByteValue(&v[0], (uint32_t)v.size());
if (mec_mr3_memcpy(v.data(), bv->GetPointer(), bv->GetLength())) {
clean.SetByteValue(v.data(), (uint32_t)v.size());
ds.Replace(clean);
return true;
}
@ -1017,7 +1000,7 @@ static bool CleanPMTF(DataSet &ds, const DataElement &de) {
{
std::vector<char> copy(input, input + len);
std::reverse(copy.begin(), copy.end());
std::string dup(&copy[0], copy.size());
std::string dup(copy.data(), copy.size());
is.str(dup);
}
@ -1046,7 +1029,7 @@ static bool CleanPMTF(DataSet &ds, const DataElement &de) {
DataElement clean(de.GetTag());
clean.SetVR(de.GetVR());
clean.SetByteValue(&v[0], (uint32_t)v.size());
clean.SetByteValue(v.data(), (uint32_t)v.size());
ds.Replace(clean);
}
} catch (...) {
@ -1082,7 +1065,7 @@ static bool IsDPathInSet(std::set<DPath> const &aset, DPath const dpath) {
}
Cleaner::impl::ACTION Cleaner::impl::ComputeAction(
File const &file, DataSet &ds, const DataElement &de, VR const &ref_dict_vr,
File const & /*file*/, DataSet &ds, const DataElement &de, VR const &ref_dict_vr,
const std::string &tag_path) {
const Tag &tag = de.GetTag();
// Group Length & Illegal cannot be preserved so it is safe to do them now:

View File

@ -76,7 +76,7 @@ public:
os << "TypeOfData :" << TypeOfData << std::endl;
os << "CurveDescription :" << CurveDescription << std::endl;
os << "DataValueRepresentation :" << DataValueRepresentation << std::endl;
const unsigned short * p = (const unsigned short*)(const void*)&Data[0];
const unsigned short * p = (const unsigned short*)(const void*)Data.data();
for(int i = 0; i < NumberOfPoints; i+=2)
{
os << p[i] << "," << p[i+1] << std::endl;
@ -450,7 +450,7 @@ void Curve::GetAsPoints(float *array) const
assert( 0 && "TODO" );
}
}
const char * beg = &Internal->Data[0];
const char * beg = Internal->Data.data();
const char * end = beg + Internal->Data.size();
if( genidx == -1 )
{
@ -466,7 +466,7 @@ void Curve::GetAsPoints(float *array) const
{
// PS 3.3 - 2004
// C.10.2.1.5 Curve data descriptor, coordinate start value, coordinate step value
uint16_t * p = (uint16_t*)(void*)&Internal->Data[0];
uint16_t * p = (uint16_t*)(void*)Internal->Data.data();
// X
if( genidx == 0 )
for(int i = 0; i < Internal->NumberOfPoints; i++ )
@ -502,7 +502,7 @@ void Curve::GetAsPoints(float *array) const
}
else if( Internal->DataValueRepresentation == 1 )
{
int16_t * p = (int16_t*)(void*)&Internal->Data[0];
int16_t * p = (int16_t*)(void*)Internal->Data.data();
for(int i = 0; i < Internal->NumberOfPoints; i++ )
{
array[3*i+0] = p[mult*i + 0];
@ -515,7 +515,7 @@ void Curve::GetAsPoints(float *array) const
}
else if( Internal->DataValueRepresentation == 2 )
{
float * p = (float*)(void*)&Internal->Data[0];
float * p = (float*)(void*)Internal->Data.data();
for(int i = 0; i < Internal->NumberOfPoints; i++ )
{
array[3*i+0] = p[mult*i + 0];
@ -528,7 +528,7 @@ void Curve::GetAsPoints(float *array) const
}
else if( Internal->DataValueRepresentation == 3 )
{
double * p = (double*)(void*)&Internal->Data[0];
double * p = (double*)(void*)Internal->Data.data();
for(int i = 0; i < Internal->NumberOfPoints; i++ )
{
array[3*i+0] = (float)p[mult*i + 0];
@ -541,7 +541,7 @@ void Curve::GetAsPoints(float *array) const
}
else if( Internal->DataValueRepresentation == 4 )
{
int32_t * p = (int32_t*)(void*)&Internal->Data[0];
int32_t * p = (int32_t*)(void*)Internal->Data.data();
for(int i = 0; i < Internal->NumberOfPoints; i++ )
{
array[3*i+0] = (float)p[mult*i + 0];

View File

@ -17,9 +17,9 @@
namespace gdcm {
DPath::DPath() {}
DPath::DPath() = default;
DPath::~DPath() {}
DPath::~DPath() = default;
// LO mandates that '\\' is never used:
static const char SEPARATOR = '\\';
@ -121,7 +121,7 @@ bool DPath::ConstructFromString(const char *spath) {
gdcm::Tag t;
std::ostringstream os;
std::vector<std::string>::const_iterator it = comps.begin();
unsigned int index;
unsigned int index = 0;
assert(comps.size() >= 2);
// check root
if (!it->empty()) return false;

View File

@ -212,10 +212,9 @@ VR DataSetHelper::ComputeVR(File const &file, DataSet const &ds, const Tag& tag)
else // ( pixeldata == t )
{
// For Pixel Data:
if( !ds.FindDataElement( bitsallocated ) )
return VR::UN;
// if( !ds.FindDataElement( bitsallocated ) ) return VR::UN;
Attribute<0x0028,0x0100> at;
at.SetFromDataElement( ds.GetDataElement( bitsallocated ) );
// at.SetFromDataElement( ds.GetDataElement( bitsallocated ) );
}
(void)v;

View File

@ -26,8 +26,6 @@ class SequenceOfItems;
/**
* \brief DataSetHelper (internal class, not intended for user level)
*
* \details
*/
class GDCM_EXPORT DataSetHelper
{

View File

@ -27,9 +27,6 @@ DictPrinter::DictPrinter()
}
//-----------------------------------------------------------------------------
DictPrinter::~DictPrinter()
= default;
VM GuessVMType(DataElement const &de)
{
if( de.IsEmpty() ) return VM::VM1;

View File

@ -27,7 +27,7 @@ class GDCM_EXPORT DictPrinter : public Printer
{
public:
DictPrinter();
~DictPrinter();
~DictPrinter() = default;
void Print(std::ostream& os);

View File

@ -13,9 +13,9 @@
=========================================================================*/
#include "gdcmDirectionCosines.h"
#include <cmath> // fabs
#include <cstdio> // sscanf
#include <limits>
#include <math.h> // fabs
#include <stdio.h> // sscanf
namespace gdcm
{
@ -40,8 +40,6 @@ DirectionCosines::DirectionCosines(const double dircos[6])
Values[5] = dircos[5];
}
DirectionCosines::~DirectionCosines() = default;
void DirectionCosines::Print(std::ostream &os) const
{
os << Values[0] << ",";

View File

@ -29,7 +29,7 @@ public:
DirectionCosines(const double dircos[6]);
// Cannot get the following signature to be wrapped with swig...
//DirectionCosines(const double *dircos = 0 );
~DirectionCosines();
~DirectionCosines() = default;
/// Print
void Print(std::ostream &) const;

View File

@ -35,10 +35,10 @@ Directory::FilenamesType DirectoryHelper::GetSeriesUIDsBySOPClassUID(const std::
theScanner.GetFilenameFromTagToValue(Tag(0x0020,0x000e), theSeriesValues[i].c_str());
std::string theSOPClassUID = theScanner.GetValue(theFirstFilename.c_str(), Tag(0x0008,0x0016));
//dicom strings sometimes have trailing spaces; make sure to avoid those
size_t endpos = theSOPClassUID.find_last_not_of(" "); // Find the first character position from reverse af
size_t endpos = theSOPClassUID.find_last_not_of(' '); // Find the first character position from reverse af
if( std::string::npos != endpos )
theSOPClassUID = theSOPClassUID.substr( 0, endpos+1 );
if (theSOPClassUID == inSOPClassUID.c_str()){
if (theSOPClassUID == inSOPClassUID){
theReturn.push_back(theSeriesValues[i]);
}
}
@ -88,7 +88,7 @@ Directory::FilenamesType DirectoryHelper::GetFilenamesFromSeriesUIDs(const std::
{
std::string theSeriesUID = theSeriesValues[i];
//dicom strings sometimes have trailing spaces; make sure to avoid those
size_t endpos = theSeriesUID.find_last_not_of(" "); // Find the first character position from reverse af
size_t endpos = theSeriesUID.find_last_not_of(' '); // Find the first character position from reverse af
if( std::string::npos != endpos )
theSeriesUID = theSeriesUID.substr( 0, endpos+1 );
if (inSeriesUID == theSeriesUID)

View File

@ -22,7 +22,6 @@ namespace gdcm
// It's a sink there is no output
/**
* \brief Codec class
* \details
* \note
* Use it to simply dump value read from the file. No interpretation is done.
* But it is real fast ! Almost no overhead

Some files were not shown because too many files have changed in this diff Show More