I try to save pixel data with createValueFromTempFile(). This works fine if the pixel data are stored as 16Bit values in my temporary file. If i try to store 32Bit (Uint32) values with createValueFromTempFile() from the temporay file, the DICOM file is saved without errors but I think the interpretation is wrong when reading the temporary file. Only the first 10 pixels are ok.
I want to replace the following code (that is working fine):
Code: Select all
std::vector<Uint32> l_vecInput = FloatVectorToUint32Vector( m_vecFloatData, m_fDoseGridScaling);
l_oStatus = p_oDcmDataset.putAndInsertUint16Array(DCM_PixelData, (Uint16*)&(l_vecInput[0]), m_iColumns * m_iRows * m_iNumberOfFrames * 2);
Code: Select all
std::ofstream ostr(m_oTemporaryPixelDataFile.path().c_str());
std::vector<Uint32> l_vecUint32 = FloatVectorToUint32Vector(m_vecFloatData, m_fDoseGridScaling);
ostr.write((char*)&l_vecUint32[0], sizeof(Uint32) * l_vecUint32.size());
ostr.flush();
ostr.close();
DcmPixelData *l_elem = new DcmPixelData(DCM_PixelData);
if(l_oStatus.good())
{
const size_t fileLen = OFStandard::getFileSize(m_oTemporaryPixelDataFile.path().c_str());
l_oStatus = l_elem->createValueFromTempFile(new DcmInputFileStreamFactory(m_oTemporaryPixelDataFile.path().c_str(), 0), fileLen, EBO_LittleEndian);
l_oStatus = p_oDcmDataset.insert(l_elem);
}
Any Idea how to solve the problem?
Thanks!
Jürgen