X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FDense2007ToDicom.cxx;h=e8c30c4dd40bb88ba7886d1700137362a2c51ef9;hb=8d0468bd872660b30ce957dd00004ea205a2b135;hp=cb58bb01c4e70d453d8f82ae2aa5fcd83a52ba29;hpb=538ecd6d293df9b7979694c8f93c9390a04a45f5;p=gdcm.git diff --git a/Example/Dense2007ToDicom.cxx b/Example/Dense2007ToDicom.cxx index cb58bb01..e8c30c4d 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/29 17:13:59 $ + Version: $Revision: 1.5 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -20,6 +20,10 @@ #include //#include +#if defined(__BORLANDC__) +#include +#endif + #include "gdcmFile.h" #include "gdcmFileHelper.h" #include "gdcmDebug.h" @@ -603,14 +607,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 +674,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();