I wonder that you want to write a element with DICOM (OF) VR, if so, you can use DcmOtherFloat class. a class representing the DICOM value representation 'Other Float String' (OF)
Version 3.6.0. Compiled on both gcc 3.3 and 3.4 with same result (I know, slightly old versions).
Thanks for the clue about "len". I added a sizeof(Float32) in my code, makes no difference to the seg fault. I was using putFloat32Array for a while but decided I didn't want a Float32 array hanging around just to pass to putFloat32Array. I can always go back if putFloat32 "doesn't work".
Could you please try to construct the DcmFloatingPointSingle with len=0 and then call putFloat32() in increasing order of the pos parameter, i.e. 0, 1, 2, ... This is because (taken from the API documentation of DcmElement):
* @param pos position for insert operation. Value: pos <= getVM(), i.e. a value
* can be appended to the end of the current element or inserted within the
* existing value field.
[...]
virtual OFCondition putFloat32(const Float32 val, const unsigned long pos = 0);
J. Riesmeier wrote:Could you please try to construct the DcmFloatingPointSingle with len=0 and then call putFloat32() in increasing order of the pos parameter, i.e. 0, 1, 2, ...
Yes, that works. Thank you!
So it seems there is only a problem if the array length is declared with the constructor. I double checked (putting 100000 as the 2nd argument) and the seg fault reappeared.