X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FDense2007ToDicom.cxx;h=6cc49ff66e95fcae5e1d09b76941f8879972424d;hb=3b1f653b219f72d841e3b52ef2ae20d2c7c91220;hp=cb58bb01c4e70d453d8f82ae2aa5fcd83a52ba29;hpb=4249e0d6fb6942a1b221a74f42bff4acd773105d;p=gdcm.git diff --git a/Example/Dense2007ToDicom.cxx b/Example/Dense2007ToDicom.cxx index cb58bb01..6cc49ff6 100755 --- a/Example/Dense2007ToDicom.cxx +++ b/Example/Dense2007ToDicom.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: Dense2007ToDicom.cxx,v $ Language: C++ - Date: $Date: 2007/10/15 13:55:35 $ - Version: $Revision: 1.3 $ + Date: $Date: 2007/10/24 08:03:10 $ + Version: $Revision: 1.4 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -603,14 +603,27 @@ void MakeDicomImage(float *tabVal, float *X, float *Y, float *Z, int NP, std::st std::cout << "Max X,Y,Z " << maxX << " " << maxY << " " << maxZ << std::endl; std::cout << "Size X,Y,Z " << maxX-minX << " " << maxY-minY << " " << maxZ-minZ << std::endl; - uint16_t *img = new uint16_t[int(maxX)*int(maxY)]; +// uint16_t *img = new uint16_t[int(maxX+0.5)*int(maxY+0.5)]; + uint16_t *img = new uint16_t[int(maxX*4.)*int(maxY*4.)]; // Set whole image to 0 - for(int i3=0;i3InsertEntryString(str.str(),0x0028,0x0011,"US"); // Columns str.str(""); - str << (int)(maxY); + str << (int)(maxY*4.); file->InsertEntryString(str.str(),0x0028,0x0010,"US"); // Rows // Set the pixel type @@ -657,7 +670,7 @@ void MakeDicomImage(float *tabVal, float *X, float *Y, float *Z, int NP, std::st fileH = GDCM_NAME_SPACE::FileHelper::New(file); // cast is just to avoid warnings (*no* conversion) //fileH->SetImageData((uint8_t *)img,int(maxX*maxY)*sizeof(uint16_t)); // troubles when maxX, mayY are *actually* float! - fileH->SetImageData((uint8_t *)img,int(maxX)*int(maxY)*sizeof(uint16_t)); + fileH->SetImageData((uint8_t *)img,int(maxX*4.)*int(maxY*4.)*sizeof(uint16_t)); fileH->SetWriteModeToRaw(); fileH->SetWriteTypeToDcmExplVR();