[Dcmlib] Re: write dicom to unsigned short

Jean-Pierre Roux Jean-Pierre.Roux at creatis.insa-lyon.fr
Mon Jan 2 15:40:15 CET 2006


acid wrote:

>Dear sir,
>I try to write dicom to unsigned short
>and my code is what below
>but the output will look like "unsigned char",
>I wonder which information should be set to the output dicom
>to have a correct result,
>  
>

Did you set the image sizes?

m_dicomw->InsertEntryString(strCol.str(),0x0028,0x0011); // Columns
m_dicomw->InsertEntryString(strRow.str(),0x0028,0x0010); // Rows

And the pixels characteristics?

 Bits Allocated (=16) , Bits Stored (=16), High Bit (=15), Pixel Representation (=1)

// and, if image is RGB
 Samples Per Pixel (=3 ) 
 PlanarConfiguration (=1) 


>thanks again!
>
>Sincerely,Alison
>
>void IMT_DICOMInfo::Write (PixelData2D<unsigned short> *output)
>{
>	UnsShortSetInfo();
>	int size=output->m_uXDim*output->m_uYDim*output->m_uNChannel*sizeof(unsigned short);
>
>	m_dicomWrite->SetImageData((unsigned char *)output->m_buffer[0][0],size);
>	m_dicomWrite->SetWriteModeToRaw(); // no LUT, no compression.
>	m_dicomWrite->SetWriteTypeToDcmExplVR();
>
>   if( !m_dicomWrite->Write(m_out ) )
>   {
>		printf("not writable/n");     
>   }
>
>   m_dicomWrite->Delete();
>}
>
>  
>




More information about the Dcmlib mailing list