[Gdcm-hackers] gdcm-git:Grassroots DICOM branch release updated. 2ef6054c83c212fa177547a71912390c65
Cross-platform DICOM implementation
Brought to you by:
malat
|
From: malat <ma...@us...> - 2023-05-02 09:08:28
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Grassroots DICOM".
The branch, release has been updated
via 2ef6054c83c212fa177547a71912390c65330e8f (commit)
via 496d50fd3ba03c7ea274d44f4395bbc5c2aaceac (commit)
via c716feb348027408486343b4b60d9f4dec05b7ec (commit)
from bd4e7aa365f03dac434976244ec7ef06bbb0ebc4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sourceforge.net/p/gdcm/gdcm/ci/2ef6054c83c212fa177547a71912390c65330e8f/
commit 2ef6054c83c212fa177547a71912390c65330e8f
Author: Sean McBride <se...@ro...>
Date: Tue Apr 4 23:06:50 2023 -0400
Auto-fixed all clang-tidy google-build-explicit-make-pair warnings
diff --git a/.clang-tidy b/.clang-tidy
index e57ba33b8..9d6b66bbc 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -64,7 +64,6 @@ Checks: '-*,
-google-build-using-namespace,
-google-explicit-constructor,
-google-default-arguments,
- -google-build-explicit-make-pair,
-google-readability-function-size,
hicpp-*,
-hicpp-no-array-decay,
diff --git a/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx b/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx
index 6901cd61b..c8645a27f 100644
--- a/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx
@@ -683,7 +683,7 @@ std::pair<char *, size_t> JPEG2000Codec::DecodeByStreamsCommon(char *dummy_buffe
break;
default:
gdcmErrorMacro( "Impossible happen" );
- return std::make_pair<char*,size_t>(nullptr,0);
+ return std::pair<char*,size_t>(nullptr,0);
}
#if ((OPJ_VERSION_MAJOR == 2 && OPJ_VERSION_MINOR >= 3) || (OPJ_VERSION_MAJOR > 2))
opj_codec_set_threads(dinfo, Internals->nNumberOfThreadsForDecompression);
@@ -714,7 +714,7 @@ std::pair<char *, size_t> JPEG2000Codec::DecodeByStreamsCommon(char *dummy_buffe
opj_destroy_codec(dinfo);
opj_stream_destroy(cio);
gdcmErrorMacro( "opj_setup_decoder failure" );
- return std::make_pair<char*,size_t>(nullptr,0);
+ return std::pair<char*,size_t>(nullptr,0);
}
#if 0
OPJ_INT32 l_tile_x0,l_tile_y0;
@@ -729,7 +729,7 @@ std::pair<char *, size_t> JPEG2000Codec::DecodeByStreamsCommon(char *dummy_buffe
opj_destroy_codec(dinfo);
opj_stream_destroy(cio);
gdcmErrorMacro( "opj_setup_decoder failure" );
- return std::make_pair<char*,size_t>(nullptr,0);
+ return std::pair<char*,size_t>(nullptr,0);
}
#if 0
/* Optional if you want decode the entire image */
@@ -743,7 +743,7 @@ std::pair<char *, size_t> JPEG2000Codec::DecodeByStreamsCommon(char *dummy_buffe
opj_destroy_codec(dinfo);
opj_stream_destroy(cio);
gdcmErrorMacro( "opj_decode failed" );
- return std::make_pair<char*,size_t>(nullptr,0);
+ return std::pair<char*,size_t>(nullptr,0);
}
bResult = bResult && (image != nullptr);
bResult = bResult && opj_end_decompress(dinfo,cio);
@@ -752,7 +752,7 @@ std::pair<char *, size_t> JPEG2000Codec::DecodeByStreamsCommon(char *dummy_buffe
opj_destroy_codec(dinfo);
opj_stream_destroy(cio);
gdcmErrorMacro( "opj_decode failed" );
- return std::make_pair<char*,size_t>(nullptr,0);
+ return std::pair<char*,size_t>(nullptr,0);
}
#if 0
diff --git a/Utilities/.clang-tidy b/Utilities/.clang-tidy
index 5fd88bef0..8baac2daf 100644
--- a/Utilities/.clang-tidy
+++ b/Utilities/.clang-tidy
@@ -75,7 +75,6 @@ Checks: '-*,
-google-build-using-namespace,
-google-explicit-constructor,
-google-default-arguments,
- -google-build-explicit-make-pair,
-google-readability-function-size,
hicpp-*,
-hicpp-no-array-decay,
https://sourceforge.net/p/gdcm/gdcm/ci/496d50fd3ba03c7ea274d44f4395bbc5c2aaceac/
commit 496d50fd3ba03c7ea274d44f4395bbc5c2aaceac
Author: Sean McBride <se...@ro...>
Date: Wed Apr 5 10:22:29 2023 -0400
Auto-fixed most clang-tidy readability-container-data-pointer warnings
3 of the changes clang-tidy made did not compile due to const mismatches, they were reverted.
diff --git a/Applications/Cxx/gdcmconv.cxx b/Applications/Cxx/gdcmconv.cxx
index aa924d991..3b018af48 100644
--- a/Applications/Cxx/gdcmconv.cxx
+++ b/Applications/Cxx/gdcmconv.cxx
@@ -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 );
diff --git a/Applications/Cxx/gdcmdump.cxx b/Applications/Cxx/gdcmdump.cxx
index db9299a2d..9cc80ac78 100644
--- a/Applications/Cxx/gdcmdump.cxx
+++ b/Applications/Cxx/gdcmdump.cxx
@@ -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( ©[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;
diff --git a/Applications/Cxx/gdcmpap3.cxx b/Applications/Cxx/gdcmpap3.cxx
index b918b0d6a..ae79f9f3e 100644
--- a/Applications/Cxx/gdcmpap3.cxx
+++ b/Applications/Cxx/gdcmpap3.cxx
@@ -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
}
diff --git a/Applications/Cxx/gdcmtar.cxx b/Applications/Cxx/gdcmtar.cxx
index a0d39ea0e..e9264630c 100644
--- a/Applications/Cxx/gdcmtar.cxx
+++ b/Applications/Cxx/gdcmtar.cxx
@@ -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() )
{
diff --git a/Examples/Cxx/DumpImageHeaderInfo.cxx b/Examples/Cxx/DumpImageHeaderInfo.cxx
index 2476f7421..01de60409 100644
--- a/Examples/Cxx/DumpImageHeaderInfo.cxx
+++ b/Examples/Cxx/DumpImageHeaderInfo.cxx
@@ -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;
diff --git a/Examples/Cxx/DumpPhilipsECHO.cxx b/Examples/Cxx/DumpPhilipsECHO.cxx
index af58230fe..cb1b64f18 100644
--- a/Examples/Cxx/DumpPhilipsECHO.cxx
+++ b/Examples/Cxx/DumpPhilipsECHO.cxx
@@ -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 )
diff --git a/Examples/Cxx/DumpSiemensBase64.cxx b/Examples/Cxx/DumpSiemensBase64.cxx
index 1cae92241..d24cb72a9 100644
--- a/Examples/Cxx/DumpSiemensBase64.cxx
+++ b/Examples/Cxx/DumpSiemensBase64.cxx
@@ -59,10 +59,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;
diff --git a/Examples/Cxx/DumpToshibaDTI.cxx b/Examples/Cxx/DumpToshibaDTI.cxx
index f35eb50c3..ffae9454a 100644
--- a/Examples/Cxx/DumpToshibaDTI.cxx
+++ b/Examples/Cxx/DumpToshibaDTI.cxx
@@ -43,7 +43,7 @@ static bool DumpToshibaDTI( const char * input, size_t len )
#else
std::istringstream is;
- std::string dup( ©[0], copy.size() );
+ std::string dup( copy.data(), copy.size() );
is.str( dup );
gdcm::File file;
diff --git a/Examples/Cxx/DumpToshibaDTI2.cxx b/Examples/Cxx/DumpToshibaDTI2.cxx
index d24d9ab55..e2d2bcc5a 100644
--- a/Examples/Cxx/DumpToshibaDTI2.cxx
+++ b/Examples/Cxx/DumpToshibaDTI2.cxx
@@ -43,7 +43,7 @@ static bool DumpToshibaDTI2( const char * input, size_t len )
#else
std::istringstream is;
- std::string dup( ©[0], copy.size() );
+ std::string dup( copy.data(), copy.size() );
is.str( dup );
gdcm::File file;
diff --git a/Examples/Cxx/FixJAIBugJPEGLS.cxx b/Examples/Cxx/FixJAIBugJPEGLS.cxx
index c422c4eb9..01bd0580c 100644
--- a/Examples/Cxx/FixJAIBugJPEGLS.cxx
+++ b/Examples/Cxx/FixJAIBugJPEGLS.cxx
@@ -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, ¶ms, errorMsg );
+ JpegLsDecode(rgbyteOut.data(), rgbyteOut.size(), pbyteCompressed, cbyteCompressed, ¶ms, 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
diff --git a/Examples/Cxx/GetSubSequenceData.cxx b/Examples/Cxx/GetSubSequenceData.cxx
index c512817f7..7cd0d59e2 100644
--- a/Examples/Cxx/GetSubSequenceData.cxx
+++ b/Examples/Cxx/GetSubSequenceData.cxx
@@ -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;
diff --git a/Examples/Cxx/LargeVRDSExplicit.cxx b/Examples/Cxx/LargeVRDSExplicit.cxx
index f5cf64500..ed225325d 100644
--- a/Examples/Cxx/LargeVRDSExplicit.cxx
+++ b/Examples/Cxx/LargeVRDSExplicit.cxx
@@ -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() );
diff --git a/Examples/Cxx/pmsct_rgb1.cxx b/Examples/Cxx/pmsct_rgb1.cxx
index 21a3806cd..22263be03 100644
--- a/Examples/Cxx/pmsct_rgb1.cxx
+++ b/Examples/Cxx/pmsct_rgb1.cxx
@@ -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
diff --git a/Examples/Cxx/rle2img.cxx b/Examples/Cxx/rle2img.cxx
index 400931958..16e8bf54e 100644
--- a/Examples/Cxx/rle2img.cxx
+++ b/Examples/Cxx/rle2img.cxx
@@ -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*...)
diff --git a/Source/Common/gdcmFilename.cxx b/Source/Common/gdcmFilename.cxx
index 80eda8d9e..5384510db 100644
--- a/Source/Common/gdcmFilename.cxx
+++ b/Source/Common/gdcmFilename.cxx
@@ -56,10 +56,10 @@ const char *Filename::GetName()
#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()
diff --git a/Source/Common/gdcmMD5.cxx b/Source/Common/gdcmMD5.cxx
index 89a966d5e..a4f985cee 100644
--- a/Source/Common/gdcmMD5.cxx
+++ b/Source/Common/gdcmMD5.cxx
@@ -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;
diff --git a/Source/DataStructureAndEncodingDefinition/gdcmByteValue.cxx b/Source/DataStructureAndEncodingDefinition/gdcmByteValue.cxx
index b48f6de8b..432cdde99 100644
--- a/Source/DataStructureAndEncodingDefinition/gdcmByteValue.cxx
+++ b/Source/DataStructureAndEncodingDefinition/gdcmByteValue.cxx
@@ -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 );
diff --git a/Source/DataStructureAndEncodingDefinition/gdcmCSAHeader.cxx b/Source/DataStructureAndEncodingDefinition/gdcmCSAHeader.cxx
index 5b8880667..ad944ac64 100644
--- a/Source/DataStructureAndEncodingDefinition/gdcmCSAHeader.cxx
+++ b/Source/DataStructureAndEncodingDefinition/gdcmCSAHeader.cxx
@@ -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 );
}
diff --git a/Source/DataStructureAndEncodingDefinition/gdcmSequenceOfFragments.cxx b/Source/DataStructureAndEncodingDefinition/gdcmSequenceOfFragments.cxx
index 67bdcc696..943596bd6 100644
--- a/Source/DataStructureAndEncodingDefinition/gdcmSequenceOfFragments.cxx
+++ b/Source/DataStructureAndEncodingDefinition/gdcmSequenceOfFragments.cxx
@@ -144,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;
}
diff --git a/Source/MediaStorageAndFileFormat/gdcmBitmap.cxx b/Source/MediaStorageAndFileFormat/gdcmBitmap.cxx
index d1aeb8449..f92a11323 100644
--- a/Source/MediaStorageAndFileFormat/gdcmBitmap.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmBitmap.cxx
@@ -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
diff --git a/Source/MediaStorageAndFileFormat/gdcmCleaner.cxx b/Source/MediaStorageAndFileFormat/gdcmCleaner.cxx
index deeb0e313..e16001526 100644
--- a/Source/MediaStorageAndFileFormat/gdcmCleaner.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmCleaner.cxx
@@ -875,8 +875,8 @@ static bool CleanCSAImage(DataSet &ds, const DataElement &de) {
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;
}
@@ -931,8 +931,8 @@ static bool CleanCSASeries(DataSet &ds, const DataElement &de) {
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;
}
@@ -976,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;
}
@@ -1000,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(©[0], copy.size());
+ std::string dup(copy.data(), copy.size());
is.str(dup);
}
@@ -1029,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 (...) {
diff --git a/Source/MediaStorageAndFileFormat/gdcmCurve.cxx b/Source/MediaStorageAndFileFormat/gdcmCurve.cxx
index 92d86968f..a8d9f7c1c 100644
--- a/Source/MediaStorageAndFileFormat/gdcmCurve.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmCurve.cxx
@@ -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];
diff --git a/Source/MediaStorageAndFileFormat/gdcmFileChangeTransferSyntax.cxx b/Source/MediaStorageAndFileFormat/gdcmFileChangeTransferSyntax.cxx
index 01761e627..cfd62a65d 100644
--- a/Source/MediaStorageAndFileFormat/gdcmFileChangeTransferSyntax.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmFileChangeTransferSyntax.cxx
@@ -131,7 +131,7 @@ bool FileChangeTransferSyntax::Change()
std::vector<char> vbuffer;
vbuffer.resize( dims[0] * pixsize );
- char *data = &vbuffer[0];
+ char *data = vbuffer.data();
const size_t datalen = vbuffer.size();
const size_t nscanlines = dims[2] * dims[1];
@@ -176,7 +176,7 @@ bool FileChangeTransferSyntax::Change()
std::vector<char> vbuffer;
vbuffer.resize( dims[0] * dims[1] * pixsize );
- char *data = &vbuffer[0];
+ char *data = vbuffer.data();
const size_t datalen = vbuffer.size();
const size_t nscanlines = dims[2];
diff --git a/Source/MediaStorageAndFileFormat/gdcmIconImageGenerator.cxx b/Source/MediaStorageAndFileFormat/gdcmIconImageGenerator.cxx
index 1d0e331b7..496979d04 100644
--- a/Source/MediaStorageAndFileFormat/gdcmIconImageGenerator.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmIconImageGenerator.cxx
@@ -345,10 +345,10 @@ void IconImageGenerator::BuildLUT( Bitmap & bitmap, unsigned int maxcolor )
for( int i = 0; i < 3; ++i )
{
lut.InitializeLUT( LookupTable::LookupTableType(i), (unsigned short)ncolors, 0, 8 );
- lut.SetLUT( LookupTable::LookupTableType(i), &buffer[i][0], (unsigned short)ncolors );
+ lut.SetLUT( LookupTable::LookupTableType(i), buffer[i].data(), (unsigned short)ncolors );
}
- bitmap.GetDataElement().SetByteValue( (char*)&indeximage[0], (uint32_t)indeximage.size() );
+ bitmap.GetDataElement().SetByteValue( (char*)indeximage.data(), (uint32_t)indeximage.size() );
assert( lut.Initialized() );
}
@@ -544,7 +544,7 @@ f. If a Palette Color lookup Table is used, an 8 Bit Allocated (0028,0100) shall
framelen /= dims[2];
}
vbuffer.resize( P->GetBufferLength() );
- char *buffer = &vbuffer[0];
+ char *buffer = vbuffer.data();
bool boolean = P->GetBuffer(buffer);
if( !boolean ) return false;
@@ -560,8 +560,8 @@ f. If a Palette Color lookup Table is used, an 8 Bit Allocated (0028,0100) shall
uint8_t ps = I->GetPixelFormat().GetPixelSize();
- char *iconb = &vbuffer2[0];
- char *imgb = &vbuffer[0];
+ char *iconb = vbuffer2.data();
+ char *imgb = vbuffer.data();
const unsigned int *imgdims = P->GetDimensions();
const unsigned int stepi = imgdims[0] / Internals->dims[0];
@@ -581,7 +581,7 @@ f. If a Palette Color lookup Table is used, an 8 Bit Allocated (0028,0100) shall
// Apply LUT
if( P->GetPhotometricInterpretation() == PhotometricInterpretation::PALETTE_COLOR )
{
- std::string tempvbuf(&vbuffer2[0], vbuffer2.size());
+ std::string tempvbuf(vbuffer2.data(), vbuffer2.size());
std::istringstream is( tempvbuf );
std::stringstream ss;
P->GetLUT().Decode( is, ss );
@@ -613,7 +613,7 @@ f. If a Palette Color lookup Table is used, an 8 Bit Allocated (0028,0100) shall
std::vector<char> v8;
v8.resize( Internals->dims[0] * Internals->dims[1] * 3 );
- if( !r.Rescale(&v8[0],&s[0],s.size()) )
+ if( !r.Rescale(v8.data(),s.data(),s.size()) )
{
assert( 0 ); // should not happen in real life
gdcmErrorMacro( "Problem in the rescaler" );
@@ -626,12 +626,12 @@ f. If a Palette Color lookup Table is used, an 8 Bit Allocated (0028,0100) shall
// re-encode:
std::stringstream ss2;
- ss2.str( std::string( &v8[0], v8.size() ) );
+ ss2.str( std::string( v8.data(), v8.size() ) );
std::string s2 = ss2.str();
// As per standard, we only support 8bits icon
I->SetPixelFormat( PixelFormat::UINT8 );
- pixeldata.SetByteValue( &s2[0], (uint32_t)s2.size() );
+ pixeldata.SetByteValue( s2.data(), (uint32_t)s2.size() );
BuildLUT( *I, 256 );
}
@@ -639,7 +639,7 @@ f. If a Palette Color lookup Table is used, an 8 Bit Allocated (0028,0100) shall
{
I->SetPixelFormat( PixelFormat::UINT8 );
I->GetPixelFormat().SetSamplesPerPixel( 3 );
- pixeldata.SetByteValue( &v8[0], (uint32_t)v8.size() );
+ pixeldata.SetByteValue( v8.data(), (uint32_t)v8.size() );
}
}
else
@@ -653,7 +653,7 @@ f. If a Palette Color lookup Table is used, an 8 Bit Allocated (0028,0100) shall
// As per standard, we only support 8bits icon
I->SetPixelFormat( PixelFormat::UINT8 );
- pixeldata.SetByteValue( &s[0], (uint32_t)s.size() );
+ pixeldata.SetByteValue( s.data(), (uint32_t)s.size() );
BuildLUT(*I, 256 );
}
@@ -661,7 +661,7 @@ f. If a Palette Color lookup Table is used, an 8 Bit Allocated (0028,0100) shall
{
I->SetPixelFormat( PixelFormat::UINT8 );
I->GetPixelFormat().SetSamplesPerPixel( 3 );
- pixeldata.SetByteValue( &s[0], (uint32_t)s.size() );
+ pixeldata.SetByteValue( s.data(), (uint32_t)s.size() );
}
}
}
@@ -671,14 +671,14 @@ f. If a Palette Color lookup Table is used, an 8 Bit Allocated (0028,0100) shall
|| P->GetPhotometricInterpretation() == PhotometricInterpretation::YBR_ICT
|| P->GetPhotometricInterpretation() == PhotometricInterpretation::YBR_RCT )
{
- std::string tempvbuf( &vbuffer2[0], vbuffer2.size() );
+ std::string tempvbuf( vbuffer2.data(), vbuffer2.size() );
if( P->GetPhotometricInterpretation() == PhotometricInterpretation::YBR_FULL
|| P->GetPhotometricInterpretation() == PhotometricInterpretation::YBR_FULL_422 )
{
assert( I->GetPixelFormat() == PixelFormat::UINT8 );
if( P->GetPlanarConfiguration() == 0 )
{
- unsigned char *ybr = (unsigned char*)&tempvbuf[0];
+ unsigned char *ybr = (unsigned char*)tempvbuf.data();
unsigned char *ybr_out = ybr;
unsigned char *ybr_end = ybr + vbuffer2.size();
int R, G, B;
@@ -718,7 +718,7 @@ f. If a Palette Color lookup Table is used, an 8 Bit Allocated (0028,0100) shall
{
std::string tempvbufybr = tempvbuf;
- unsigned char *ybr = (unsigned char*)&tempvbufybr[0];
+ unsigned char *ybr = (unsigned char*)tempvbufybr.data();
unsigned char *ybr_end = ybr + vbuffer2.size();
assert( vbuffer2.size() % 3 == 0 );
size_t ybrl = vbuffer2.size() / 3;
@@ -726,7 +726,7 @@ f. If a Palette Color lookup Table is used, an 8 Bit Allocated (0028,0100) shall
unsigned char *ybrb = ybr + 1 * ybrl;
unsigned char *ybrc = ybr + 2 * ybrl;
- unsigned char *ybr_out = (unsigned char*)&tempvbuf[0];
+ unsigned char *ybr_out = (unsigned char*)tempvbuf.data();
unsigned char *ybr_out_end = ybr_out + vbuffer2.size();
int R, G, B;
for( ; ybr_out != ybr_out_end; )
@@ -766,7 +766,7 @@ f. If a Palette Color lookup Table is used, an 8 Bit Allocated (0028,0100) shall
assert( I->GetPixelFormat() == PixelFormat::UINT8 );
std::string tempvbufrgb = tempvbuf;
- unsigned char *rgb = (unsigned char*)&tempvbufrgb[0];
+ unsigned char *rgb = (unsigned char*)tempvbufrgb.data();
unsigned char *rgb_end = rgb + vbuffer2.size();
assert( vbuffer2.size() % 3 == 0 );
size_t rgbl = vbuffer2.size() / 3;
@@ -774,7 +774,7 @@ f. If a Palette Color lookup Table is used, an 8 Bit Allocated (0028,0100) shall
unsigned char *rgbb = rgb + 1 * rgbl;
unsigned char *rgbc = rgb + 2 * rgbl;
- unsigned char *rgb_out = (unsigned char*)&tempvbuf[0];
+ unsigned char *rgb_out = (unsigned char*)tempvbuf.data();
unsigned char *rgb_out_end = rgb_out + vbuffer2.size();
for( ; rgb_out != rgb_out_end; )
{
@@ -800,7 +800,7 @@ f. If a Palette Color lookup Table is used, an 8 Bit Allocated (0028,0100) shall
{
// As per standard, we only support 8bits icon
I->SetPixelFormat( PixelFormat::UINT8 );
- pixeldata.SetByteValue( &s[0], (uint32_t)s.size() );
+ pixeldata.SetByteValue( s.data(), (uint32_t)s.size() );
BuildLUT(*I, 256 );
}
@@ -808,7 +808,7 @@ f. If a Palette Color lookup Table is used, an 8 Bit Allocated (0028,0100) shall
{
I->SetPixelFormat( PixelFormat::UINT8 );
I->GetPixelFormat().SetSamplesPerPixel( 3 );
- pixeldata.SetByteValue( &s[0], (uint32_t)s.size() );
+ pixeldata.SetByteValue( s.data(), (uint32_t)s.size() );
}
}
else
@@ -839,7 +839,7 @@ f. If a Palette Color lookup Table is used, an 8 Bit Allocated (0028,0100) shall
std::vector<char> v8;
v8.resize( Internals->dims[0] * Internals->dims[1] * 3 );
- if( !r.Rescale(&v8[0],&s[0],s.size()) )
+ if( !r.Rescale(v8.data(),s.data(),s.size()) )
{
assert( 0 ); // should not happen in real life
gdcmErrorMacro( "Problem in the rescaler" );
@@ -852,7 +852,7 @@ f. If a Palette Color lookup Table is used, an 8 Bit Allocated (0028,0100) shall
lut.Allocate();
I->SetPixelFormat( PixelFormat::UINT8 );
- pixeldata.SetByteValue( &v8[0], (uint32_t)v8.size() );
+ pixeldata.SetByteValue( v8.data(), (uint32_t)v8.size() );
BuildLUT(*I, 256 );
}
@@ -860,14 +860,14 @@ f. If a Palette Color lookup Table is used, an 8 Bit Allocated (0028,0100) shall
{
I->SetPixelFormat( PixelFormat::UINT8 );
I->GetPixelFormat().SetSamplesPerPixel( 3 );
- pixeldata.SetByteValue( &v8[0], (uint32_t)v8.size() );
+ pixeldata.SetByteValue( v8.data(), (uint32_t)v8.size() );
}
}
}
else
{
// MONOCHROME1 / MONOCHROME2 ...
- char *buffer2 = &vbuffer2[0];
+ char *buffer2 = vbuffer2.data();
pixeldata.SetByteValue( buffer2, (uint32_t)vbuffer2.size() );
Rescaler r;
@@ -886,7 +886,7 @@ f. If a Palette Color lookup Table is used, an 8 Bit Allocated (0028,0100) shall
}
if( Internals->AutoMinMax )
{
- void *p = &vbuffer2[0];
+ void *p = vbuffer2.data();
size_t len = vbuffer2.size();
const PixelFormat &pf = I->GetPixelFormat();
assert( pf.GetSamplesPerPixel() == 1 );
@@ -963,7 +963,7 @@ f. If a Palette Color lookup Table is used, an 8 Bit Allocated (0028,0100) shall
std::vector<char> v8;
v8.resize( Internals->dims[0] * Internals->dims[1] );
- if( !r.Rescale(&v8[0],&vbuffer2[0],vbuffer2.size()) )
+ if( !r.Rescale(v8.data(),vbuffer2.data(),vbuffer2.size()) )
{
assert( 0 ); // should not happen in real life
gdcmErrorMacro( "Problem in the rescaler" );
@@ -972,7 +972,7 @@ f. If a Palette Color lookup Table is used, an 8 Bit Allocated (0028,0100) shall
// As per standard, we only support 8bits icon
I->SetPixelFormat( PixelFormat::UINT8 );
- pixeldata.SetByteValue( &v8[0], (uint32_t)v8.size() );
+ pixeldata.SetByteValue( v8.data(), (uint32_t)v8.size() );
}
// \postcondition
diff --git a/Source/MediaStorageAndFileFormat/gdcmImage.cxx b/Source/MediaStorageAndFileFormat/gdcmImage.cxx
index 78a1f7a5c..e1e03efb6 100644
--- a/Source/MediaStorageAndFileFormat/gdcmImage.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmImage.cxx
@@ -28,7 +28,7 @@ namespace gdcm
const double *Image::GetSpacing() const
{
assert( NumberOfDimensions );
- return &Spacing[0];
+ return Spacing.data();
}
double Image::GetSpacing(unsigned int idx) const
@@ -59,7 +59,7 @@ const double *Image::GetOrigin() const
{
assert( NumberOfDimensions );
if( !Origin.empty() )
- return &Origin[0];
+ return Origin.data();
return nullptr;
}
@@ -99,7 +99,7 @@ const double *Image::GetDirectionCosines() const
{
assert( NumberOfDimensions );
if( !DirectionCosines.empty() )
- return &DirectionCosines[0];
+ return DirectionCosines.data();
return nullptr;
}
double Image::GetDirectionCosines(unsigned int idx) const
diff --git a/Source/MediaStorageAndFileFormat/gdcmImageApplyLookupTable.cxx b/Source/MediaStorageAndFileFormat/gdcmImageApplyLookupTable.cxx
index 140dd2415..22030526b 100644
--- a/Source/MediaStorageAndFileFormat/gdcmImageApplyLookupTable.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmImageApplyLookupTable.cxx
@@ -57,7 +57,7 @@ bool ImageApplyLookupTable::Apply()
const unsigned long len = image.GetBufferLength();
std::vector<char> v;
v.resize( len );
- char *p = &v[0];
+ char *p = v.data();
image.GetBuffer( p );
std::stringstream is;
if( !is.write( p, len ) )
@@ -77,14 +77,14 @@ bool ImageApplyLookupTable::Apply()
std::vector<char> v2;
v2.resize( len * 3 );
if( pimpl->rgb8 )
- lut.Decode8(&v2[0], v2.size(), &v[0], v.size());
+ lut.Decode8(v2.data(), v2.size(), v.data(), v.size());
else
- lut.Decode(&v2[0], v2.size(), &v[0], v.size());
+ lut.Decode(v2.data(), v2.size(), v.data(), v.size());
assert( v2.size() < (size_t)std::numeric_limits<uint32_t>::max() );
if( pimpl->rgb8 )
- de.SetByteValue( &v2[0], (uint32_t)v2.size() / 2);
+ de.SetByteValue( v2.data(), (uint32_t)v2.size() / 2);
else
- de.SetByteValue( &v2[0], (uint32_t)v2.size() );
+ de.SetByteValue( v2.data(), (uint32_t)v2.size() );
#endif
Output->GetLUT().Clear();
Output->SetPhotometricInterpretation( PhotometricInterpretation::RGB );
diff --git a/Source/MediaStorageAndFileFormat/gdcmImageCodec.cxx b/Source/MediaStorageAndFileFormat/gdcmImageCodec.cxx
index 899d62e4a..deba8ab00 100644
--- a/Source/MediaStorageAndFileFormat/gdcmImageCodec.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmImageCodec.cxx
@@ -542,14 +542,14 @@ bool ImageCodec::DoOverlayCleanup(std::istream &is, std::ostream &os)
std::vector<uint16_t> buffer(bufferSize);
while (is)
{
- is.read((char *)&buffer[0], bufferSize * sizeof(uint16_t));
+ is.read((char *)buffer.data(), bufferSize * sizeof(uint16_t));
std::streamsize bytesRead = is.gcount();
std::vector<uint16_t>::iterator validBufferEnd = buffer.begin() + bytesRead / sizeof(uint16_t);
for (std::vector<uint16_t>::iterator it = buffer.begin(); it != validBufferEnd; ++it)
{
*it = ((*it >> (PF.GetBitsStored() - PF.GetHighBit() - 1)) & pmask);
}
- os.write((char *)&buffer[0], bytesRead);
+ os.write((char *)buffer.data(), bytesRead);
}
#else
//std::ostreambuf_iterator<char> end_of_stream_iterator;
diff --git a/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx b/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx
index 34e84b5ef..d8973f413 100644
--- a/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx
@@ -203,7 +203,7 @@ static bool ComputeZSpacingFromIPP(const DataSet &ds, double &zspacing)
if( !sqi ) return false;
assert( sqi );
double normal[3];
- DirectionCosines dc( &cosines[0] );
+ DirectionCosines dc( cosines.data() );
dc.Cross( normal );
// For each item
@@ -611,7 +611,7 @@ bool ImageHelper::GetDirectionCosinesFromDataSet(DataSet const & ds, std::vector
{
dircos[i] = at.GetValue(i);
}
- DirectionCosines dc( &dircos[0] );
+ DirectionCosines dc( dircos.data() );
if( !dc.IsValid() )
{
dc.Normalize();
@@ -2143,7 +2143,7 @@ void ImageHelper::SetDirectionCosinesValue(DataSet & ds, const std::vector<doubl
Attribute<0x0020,0x0037> iop = {{1,0,0,0,1,0}}; // default value
assert( dircos.size() == 6 );
- DirectionCosines dc( &dircos[0] );
+ DirectionCosines dc( dircos.data() );
if( !dc.IsValid() )
{
gdcmWarningMacro( "Direction Cosines are not valid. Using default value (1\\0\\0\\0\\1\\0)" );
diff --git a/Source/MediaStorageAndFileFormat/gdcmImageReader.cxx b/Source/MediaStorageAndFileFormat/gdcmImageReader.cxx
index 90852b5d1..cd945aa95 100644
--- a/Source/MediaStorageAndFileFormat/gdcmImageReader.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmImageReader.cxx
@@ -68,7 +68,7 @@ bool ImageReader::ReadImage(MediaStorage const &ms)
if( !spacing.empty() )
{
assert( spacing.size() >= pixeldata.GetNumberOfDimensions() ); // In MR, you can have a Z spacing, but store a 2D image
- pixeldata.SetSpacing( &spacing[0] );
+ pixeldata.SetSpacing( spacing.data() );
if( spacing.size() > pixeldata.GetNumberOfDimensions() ) // FIXME HACK
{
pixeldata.SetSpacing(pixeldata.GetNumberOfDimensions(), spacing[pixeldata.GetNumberOfDimensions()] );
@@ -78,7 +78,7 @@ bool ImageReader::ReadImage(MediaStorage const &ms)
std::vector<double> origin = ImageHelper::GetOriginValue(*F);
if( !origin.empty() )
{
- pixeldata.SetOrigin( &origin[0] );
+ pixeldata.SetOrigin( origin.data() );
if( origin.size() > pixeldata.GetNumberOfDimensions() ) // FIXME HACK
{
pixeldata.SetOrigin(pixeldata.GetNumberOfDimensions(), origin[pixeldata.GetNumberOfDimensions()] );
@@ -88,7 +88,7 @@ bool ImageReader::ReadImage(MediaStorage const &ms)
std::vector<double> dircos = ImageHelper::GetDirectionCosinesValue(*F);
if( !dircos.empty() )
{
- pixeldata.SetDirectionCosines( &dircos[0] );
+ pixeldata.SetDirectionCosines( dircos.data() );
}
// Do the Rescale Intercept & Slope
diff --git a/Source/MediaStorageAndFileFormat/gdcmImageRegionReader.cxx b/Source/MediaStorageAndFileFormat/gdcmImageRegionReader.cxx
index 1dbebf703..250967e32 100644
--- a/Source/MediaStorageAndFileFormat/gdcmImageRegionReader.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmImageRegionReader.cxx
@@ -174,7 +174,7 @@ bool ImageRegionReader::ReadInformation()
if( !spacing.empty() )
{
assert( spacing.size() >= pixeldata.GetNumberOfDimensions() ); // In MR, you can have a Z spacing, but store a 2D image
- pixeldata.SetSpacing( &spacing[0] );
+ pixeldata.SetSpacing( spacing.data() );
if( spacing.size() > pixeldata.GetNumberOfDimensions() ) // FIXME HACK
{
pixeldata.SetSpacing(pixeldata.GetNumberOfDimensions(), spacing[pixeldata.GetNumberOfDimensions()] );
@@ -184,7 +184,7 @@ bool ImageRegionReader::ReadInformation()
std::vector<double> origin = ImageHelper::GetOriginValue(*F);
if( !origin.empty() )
{
- pixeldata.SetOrigin( &origin[0] );
+ pixeldata.SetOrigin( origin.data() );
if( origin.size() > pixeldata.GetNumberOfDimensions() ) // FIXME HACK
{
pixeldata.SetOrigin(pixeldata.GetNumberOfDimensions(), origin[pixeldata.GetNumberOfDimensions()] );
@@ -194,7 +194,7 @@ bool ImageRegionReader::ReadInformation()
std::vector<double> dircos = ImageHelper::GetDirectionCosinesValue(*F);
if( !dircos.empty() )
{
- pixeldata.SetDirectionCosines( &dircos[0] );
+ pixeldata.SetDirectionCosines( dircos.data() );
}
// Do the Rescale Intercept & Slope
@@ -260,10 +260,10 @@ bool ImageRegionReader::ReadRAWIntoBuffer(char *buffer, size_t buflen)
std::vector<char> buffer1;
buffer1.resize( rowsize*bytesPerPixel );
- char *tmpBuffer1 = &buffer1[0];
+ char *tmpBuffer1 = buffer1.data();
std::vector<char> buffer2;
buffer2.resize( rowsize*bytesPerPixel );
- char *tmpBuffer2 = &buffer2[0];
+ char *tmpBuffer2 = buffer2.data();
unsigned int y, z;
std::streamoff theOffset;
for (z = zmin; z <= zmax; ++z)
diff --git a/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx b/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx
index 46b8698ba..6901cd61b 100644
--- a/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx
@@ -553,7 +553,7 @@ bool JPEG2000Codec::Decode(DataElement const &in, DataElement &out)
if(!r) return false;
out = in;
std::string str = os.str();
- out.SetByteValue( &str[0], (uint32_t)str.size() );
+ out.SetByteValue( str.data(), (uint32_t)str.size() );
//memcpy(buffer, os.str().c_str(), len);
return r;
}
@@ -592,7 +592,7 @@ bool JPEG2000Codec::Decode(DataElement const &in, DataElement &out)
}
std::string str = os.str();
assert( !str.empty() );
- out.SetByteValue( &str[0], (uint32_t)str.size() );
+ out.SetByteValue( str.data(), (uint32_t)str.size() );
return true;
}
@@ -1376,12 +1376,12 @@ bool JPEG2000Codec::Code(DataElement const &in, DataElement &out)
rgbyteCompressed.resize(image_width * image_height * 4);
size_t cbyteCompressed;
- const bool b = this->CodeFrameIntoBuffer((char*)&rgbyteCompressed[0], rgbyteCompressed.size(), cbyteCompressed, inputdata, inputlength );
+ const bool b = this->CodeFrameIntoBuffer((char*)rgbyteCompressed.data(), rgbyteCompressed.size(), cbyteCompressed, inputdata, inputlength );
if( !b ) return false;
Fragment frag;
assert( cbyteCompressed <= rgbyteCompressed.size() ); // default alloc would be bogus
- frag.SetByteValue( &rgbyteCompressed[0], (uint32_t)cbyteCompressed );
+ frag.SetByteValue( rgbyteCompressed.data(), (uint32_t)cbyteCompressed );
sq->AddFragment( frag );
}
@@ -1702,7 +1702,7 @@ bool JPEG2000Codec::DecodeExtent(
// update
buf_size = fraglen + oldlen;
vdummybuffer.resize( buf_size );
- dummy_buffer = &vdummybuffer[0];
+ dummy_buffer = vdummybuffer.data();
// read J2K
is.read( &vdummybuffer[oldlen], fraglen );
}
@@ -1847,10 +1847,10 @@ bool JPEG2000Codec::AppendFrameEncode( std::ostream & out, const char * data, si
rgbyteCompressed.resize(dimensions[0] * dimensions[1] * 4);
size_t cbyteCompressed;
- const bool b = this->CodeFrameIntoBuffer((char*)&rgbyteCompressed[0], rgbyteCompressed.size(), cbyteCompressed, data, datalen );
+ const bool b = this->CodeFrameIntoBuffer((char*)rgbyteCompressed.data(), rgbyteCompressed.size(), cbyteCompressed, data, datalen );
if( !b ) return false;
- out.write( (char*)&rgbyteCompressed[0], cbyteCompressed );
+ out.write( (char*)rgbyteCompressed.data(), cbyteCompressed );
return true;
}
diff --git a/Source/MediaStorageAndFileFormat/gdcmJPEGCodec.cxx b/Source/MediaStorageAndFileFormat/gdcmJPEGCodec.cxx
index 62143bac6..467e1ff64 100644
--- a/Source/MediaStorageAndFileFormat/gdcmJPEGCodec.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmJPEGCodec.cxx
@@ -346,7 +346,7 @@ bool JPEGCodec::Code(DataElement const &in, DataElement &out)
Fragment frag;
//frag.SetTag( itemStart );
VL::Type strSize = (VL::Type)str.size();
- frag.SetByteValue( &str[0], strSize );
+ frag.SetByteValue( str.data(), strSize );
sq->AddFragment( frag );
}
@@ -528,7 +528,7 @@ bool JPEGCodec::DecodeExtent(
assert( zmin == 0 );
std::stringstream iis;
- iis.write( &vdummybuffer[0], vdummybuffer.size() );
+ iis.write( vdummybuffer.data(), vdummybuffer.size() );
std::stringstream os;
bool b = DecodeByStreams(iis,os);
if(!b) return false;
@@ -542,7 +542,7 @@ bool JPEGCodec::DecodeExtent(
std::istream *theStream = &os;
std::vector<char> buffer1;
buffer1.resize( rowsize*bytesPerPixel );
- char *tmpBuffer1 = &buffer1[0];
+ char *tmpBuffer1 = buffer1.data();
unsigned int y, z;
std::streamoff theOffset;
for (z = zmin; z <= zmax; ++z)
@@ -609,7 +609,7 @@ bool JPEGCodec::DecodeExtent(
std::vector<char> buffer1;
buffer1.resize( rowsize*bytesPerPixel );
- char *tmpBuffer1 = &buffer1[0];
+ char *tmpBuffer1 = buffer1.data();
unsigned int y;
std::streamoff theOffset;
for (y = ymin; y <= ymax; ++y)
diff --git a/Source/MediaStorageAndFileFormat/gdcmJPEGLSCodec.cxx b/Source/MediaStorageAndFileFormat/gdcmJPEGLSCodec.cxx
index 8ef55d84b..38d2f6d65 100644
--- a/Source/MediaStorageAndFileFormat/gdcmJPEGLSCodec.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmJPEGLSCodec.cxx
@@ -159,7 +159,7 @@ static void ConvPlanar(std::vector<unsigned char> &input)
size_t npixels = buf_size / sizeof( T );
assert( npixels % 3 == 0 );
size_t size = npixels / 3;
- T* buffer = (T*)&input[0];
+ T* buffer = (T*)input.data();
const T *r = buffer;
const T *g = buffer + size;
@@ -173,7 +173,7 @@ static void ConvPlanar(std::vector<unsigned char> &input)
*(p++) = *(g++);
*(p++) = *(b++);
}
- std::memcpy(&input[0], copy, input.size() );
+ std::memcpy(input.data(), copy, input.size() );
delete[] copy;
}
@@ -199,7 +199,7 @@ bool JPEGLSCodec::DecodeByStreamsCommon(const char *buffer, size_t totalLen, std
rgbyteOut.resize(params.height *params.width * ((params.bitsPerSample + 7) / 8) * params.components);
- ApiResult result = JpegLsDecode(&rgbyteOut[0], rgbyteOut.size(), pbyteCompressed, cbyteCompressed, ¶ms, nullptr);
+ ApiResult result = JpegLsDecode(rgbyteOut.data(), rgbyteOut.size(), pbyteCompressed, cbyteCompressed, ¶ms, nullptr);
if( params.components == 3 )
{
@@ -245,7 +245,7 @@ bool JPEGLSCodec::Decode(DataElement const &in, DataElement &out)
out = in;
- out.SetByteValue( (char*)&rgbyteOut[0], (uint32_t)rgbyteOut.size() );
+ out.SetByteValue( (char*)rgbyteOut.data(), (uint32_t)rgbyteOut.size() );
return true;
}
else if( NumberOfDimensions == 3 )
@@ -288,7 +288,7 @@ bool JPEGLSCodec::Decode(DataElement const &in, DataElement &out)
std::vector<unsigned char> rgbyteOut;
rgbyteOut.resize(params.height *params.width * ((params.bitsPerSample + 7) / 8) * params.components);
- ApiResult result = JpegLsDecode(&rgbyteOut[0], rgbyteOut.size(), pbyteCompressed, cbyteCompressed, ¶ms, nullptr);
+ ApiResult result = JpegLsDecode(rgbyteOut.data(), rgbyteOut.size(), pbyteCompressed, cbyteCompressed, ¶ms, nullptr);
bool r = true;
delete[] mybuffer;
@@ -296,14 +296,14 @@ bool JPEGLSCodec::Decode(DataElement const &in, DataElement &out)
{
return false;
}
- os.write( (const char*)&rgbyteOut[0], rgbyteOut.size() );
+ os.write( (const char*)rgbyteOut.data(), rgbyteOut.size() );
if(!r) return false;
assert( r == true );
}
std::string str = os.str();
assert( !str.empty() );
- out.SetByteValue( &str[0], (uint32_t)str.size() );
+ out.SetByteValue( str.data(), (uint32_t)str.size() );
return true;
}
@@ -432,11 +432,11 @@ bool JPEGLSCodec::Code(DataElement const &in, DataElement &out)
rgbyteCompressed.resize(image_width * image_height * 4 * 2); // overallocate in case of weird case
size_t cbyteCompressed;
- const bool b = this->CodeFrameIntoBuffer((char*)&rgbyteCompressed[0], rgbyteCompressed.size(), cbyteCompressed, inputdata, inputlength );
+ const bool b = this->CodeFrameIntoBuffer((char*)rgbyteCompressed.data(), rgbyteCompressed.size(), cbyteCompressed, inputdata, inputlength );
if( !b ) return false;
Fragment frag;
- frag.SetByteValue( (char*)&rgbyteCompressed[0], (uint32_t)cbyteCompressed );
+ frag.SetByteValue( (char*)rgbyteCompressed.data(), (uint32_t)cbyteCompressed );
sq->AddFragment( frag );
}
@@ -492,7 +492,7 @@ bool JPEGLSCodec::DecodeExtent(
// update
buf_size = fraglen + oldlen;
vdummybuffer.resize( buf_size );
- dummy_buffer = &vdummybuffer[0];
+ dummy_buffer = vdummybuffer.data();
// read J2K
is.read( &vdummybuffer[oldlen], fraglen );
}
@@ -504,7 +504,7 @@ bool JPEGLSCodec::DecodeExtent(
bool b = DecodeByStreamsCommon(dummy_buffer, buf_size, outv);
if( !b ) return false;
- unsigned char *raw = &outv[0];
+ unsigned char *raw = outv.data();
const unsigned int rowsize = xmax - xmin + 1;
const unsigned int colsize = ymax - ymin + 1;
const unsigned int bytesPerPixel = pf.GetPixelSize();
@@ -566,7 +566,7 @@ bool JPEGLSCodec::DecodeExtent(
if( !b ) return false;
- unsigned char *raw = &outv[0];
+ unsigned char *raw = outv.data();
const unsigned int rowsize = xmax - xmin + 1;
const unsigned int colsize = ymax - ymin + 1;
const unsigned int bytesPerPixel = pf.GetPixelSize();
@@ -626,10 +626,10 @@ bool JPEGLSCodec::AppendFrameEncode( std::ostream & out, const char * data, size
rgbyteCompressed.resize(dimensions[0] * dimensions[1] * 4);
size_t cbyteCompressed;
- const bool b = this->CodeFrameIntoBuffer((char*)&rgbyteCompressed[0], rgbyteCompressed.size(), cbyteCompressed, data, datalen );
+ const bool b = this->CodeFrameIntoBuffer((char*)rgbyteCompressed.data(), rgbyteCompressed.size(), cbyteCompressed, data, datalen );
if( !b ) return false;
- out.write( (char*)&rgbyteCompressed[0], cbyteCompressed );
+ out.write( (char*)rgbyteCompressed.data(), cbyteCompressed );
return true;
}
diff --git a/Source/MediaStorageAndFileFormat/gdcmLookupTable.cxx b/Source/MediaStorageAndFileFormat/gdcmLookupTable.cxx
index 561214203..0d5a99c40 100644
--- a/Source/MediaStorageAndFileFormat/gdcmLookupTable.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmLookupTable.cxx
@@ -171,7 +171,7 @@ void LookupTable::SetLUT(LookupTableType type, const unsigned char *array,
else if( BitSample == 16 )
{
assert( Internal->Length[type]*(BitSample/8) == length );
- uint16_t *uchar16 = (uint16_t*)(void*)&Internal->RGB[0];
+ uint16_t *uchar16 = (uint16_t*)(void*)Internal->RGB.data();
const uint16_t *array16 = (const uint16_t*)(const void*)array;
for( unsigned int i = 0; i < Internal->Length[type]; ++i)
{
@@ -203,7 +203,7 @@ void LookupTable::GetLUT(LookupTableType type, unsigned char *array, unsigned in
else if( BitSample == 16 )
{
length = Internal->Length[type]*(BitSample/8);
- uint16_t *uchar16 = (uint16_t*)(void*)&Internal->RGB[0];
+ uint16_t *uchar16 = (uint16_t*)(void*)Internal->RGB.data();
uint16_t *array16 = (uint16_t*)(void*)array;
for( unsigned int i = 0; i < Internal->Length[type]; ++i)
{
@@ -479,7 +479,7 @@ void LookupTable::Decode(std::istream &is, std::ostream &os) const
else if ( BitSample == 16 )
{
// gdcmData/NM-PAL-16-PixRep1.dcm
- const uint16_t *rgb16 = (uint16_t*)(void*)&Internal->RGB[0];
+ const uint16_t *rgb16 = (uint16_t*)(void*)Internal->RGB.data();
while( !is.eof() )
{
unsigned short idx;
@@ -534,7 +534,7 @@ bool LookupTable::Decode(char *output, size_t outlen, const char *input, size_t
}
else if ( BitSample == 16 )
{
- const uint16_t *rgb16 = (const uint16_t*)(void*)&Internal->RGB[0];
+ const uint16_t *rgb16 = (const uint16_t*)(void*)Internal->RGB.data();
assert( inlen % 2 == 0 );
const uint16_t * end = (const uint16_t*)(const void*)(input + inlen);
uint16_t * rgb = (uint16_t*)(void*)output;
@@ -590,7 +590,7 @@ bool LookupTable::Decode8(char *output, size_t outlen, const char *input, size_t
}
else if ( BitSample == 16 )
{
- const uint16_t *rgb16 = (const uint16_t*)(void*)&Internal->RGB[0];
+ const uint16_t *rgb16 = (const uint16_t*)(void*)Internal->RGB.data();
assert( inlen % 2 == 0 );
const uint16_t * end = (const uint16_t*)(const void*)(input + inlen);
uint8_t * rgb = (uint8_t*)output;
@@ -616,7 +616,7 @@ const unsigned char *LookupTable::GetPointer() const
{
if ( BitSample == 8 )
{
- return &Internal->RGB[0];
+ return Internal->RGB.data();
}
return nullptr;
}
@@ -657,7 +657,7 @@ bool LookupTable::GetBufferAsRGBA(unsigned char *rgba) const
ret = true;
*/
//std::vector<unsigned char>::const_iterator it = Internal->RGB.begin();
- uint16_t *uchar16 = (uint16_t*)(void*)&Internal->RGB[0];
+ uint16_t *uchar16 = (uint16_t*)(void*)Internal->RGB.data();
uint16_t *rgba16 = (uint16_t*)(void*)rgba;
size_t s = Internal->RGB.size();
s /= 2;
@@ -702,7 +702,7 @@ bool LookupTable::WriteBufferAsRGBA(const unsigned char *rgba)
else if ( BitSample == 16 )
{
//assert( Internal->Length[type]*(BitSample/8) == length );
- uint16_t *uchar16 = (uint16_t*)(void*)&Internal->RGB[0];
+ uint16_t *uchar16 = (uint16_t*)(void*)Internal->RGB.data();
const uint16_t *rgba16 = (const uint16_t*)(const void*)rgba;
size_t s = Internal->RGB.size();
s /= 2;
@@ -737,7 +737,7 @@ void LookupTable::Print(std::ostream &os) const
{
uint16_t maxlut[3] = { 0 , 0 , 0};
uint16_t minlut[3] = { 0xffff, 0xffff, 0xffff };
- uint16_t *uchar16 = (uint16_t*)(void*)&Internal->RGB[0];
+ uint16_t *uchar16 = (uint16_t*)(void*)Internal->RGB.data();
if( Internal->Length[BLUE] != Internal->Length[RED]
|| Internal->Length[RED] != Internal->Length[GREEN] ) return;
for( unsigned int i = 0; i < Internal->Length[BLUE]; ++i)
@@ -770,7 +770,7 @@ bool LookupTable::IsRGB8() const
{
uint16_t maxlut[3] = { 0 , 0 , 0};
uint16_t minlut[3] = { 0xffff, 0xffff, 0xffff };
- uint16_t *uchar16 = (uint16_t*)(void*)&Internal->RGB[0];
+ uint16_t *uchar16 = (uint16_t*)(void*)Internal->RGB.data();
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)
diff --git a/Source/MediaStorageAndFileFormat/gdcmOverlay.cxx b/Source/MediaStorageAndFileFormat/gdcmOverlay.cxx
index 5c2d5743c..2298687f4 100644
--- a/Source/MediaStorageAndFileFormat/gdcmOverlay.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmOverlay.cxx
@@ -274,7 +274,7 @@ bool Overlay::GrabOverlayFromPixelData(DataSet const &ds)
gdcmWarningMacro("Internal Data is empty." );
return false;
}
- unsigned char * overlay = (unsigned char*)&Internal->Data[0];
+ unsigned char * overlay = (unsigned char*)Internal->Data.data();
int c = 0;
uint8_t pmask = (uint8_t)(1 << Internal->BitPosition);
assert( length / 1 == ovlength * 8 );
@@ -326,7 +326,7 @@ bool Overlay::GrabOverlayFromPixelData(DataSet const &ds)
gdcmWarningMacro("Internal Data is empty." );
return false;
}
- unsigned char * overlay = (unsigned char*)&Internal->Data[0];
+ unsigned char * overlay = (unsigned char*)Internal->Data.data();
int c = 0;
uint16_t pmask = (uint16_t)(1 << Internal->BitPosition);
assert( length / 2 == ovlength * 8 );
diff --git a/Source/MediaStorageAndFileFormat/gdcmPixmapReader.cxx b/Source/MediaStorageAndFileFormat/gdcmPixmapReader.cxx
index d4fa701cc..9c30ff8b9 100644
--- a/Source/MediaStorageAndFileFormat/gdcmPixmapReader.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmPixmapReader.cxx
@@ -1059,7 +1059,7 @@ bool PixmapReader::ReadImageInternal(MediaStorage const &ms, bool handlepixeldat
assert( jpeg.GetDimensions()[1] );
v[0] = jpeg.GetDimensions()[0];
v[1] = jpeg.GetDimensions()[1];
- ...
[truncated message content] |