Click here to Skip to main content
15,916,318 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Does anyone know flash? Pin
Christian Graus25-May-05 18:23
protectorChristian Graus25-May-05 18:23 
GeneralRe: Does anyone know flash? Pin
ThatsAlok25-May-05 18:34
ThatsAlok25-May-05 18:34 
QuestionHow to compress DICOM image to raw file format? Pin
Member 199230325-May-05 13:54
Member 199230325-May-05 13:54 
AnswerRe: How to compress DICOM image to raw file format? Pin
Christian Graus25-May-05 15:55
protectorChristian Graus25-May-05 15:55 
GeneralRe: How to compress DICOM image to raw file format? Pin
Member 199230325-May-05 19:45
Member 199230325-May-05 19:45 
GeneralRe: How to compress DICOM image to raw file format? Pin
Christian Graus25-May-05 19:47
protectorChristian Graus25-May-05 19:47 
GeneralRe: How to compress DICOM image to raw file format? Pin
Member 199230325-May-05 19:59
Member 199230325-May-05 19:59 
GeneralRe: How to compress DICOM image to raw file format? Pin
Christian Graus25-May-05 20:06
protectorChristian Graus25-May-05 20:06 
I take it image256 is a BYTE* or unsigned char * ( they are the same thing ) ?

The easiest way to get direct access to the contents of a bitmap as a BYTE * is to create a DIBSECTION, ( http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_233i.asp[^] ) which will give you a HBITMAP you can pass to BitBlt or StretchBlt, and a pointer to the image bytes. This code:

BITMAP bitmap;

if (::GetObject(bm, sizeof(BITMAP), &bitmap))
{
hdr.AddImage(new CImage(bitmap, isGrey));
}

will fill a BITMAP structure with, among other things, the width, height and width in bytes of an image. To get to specific pixel value, you index your array by x*3 ( assuming a 24 bit image, 4 for a 32 bit image, and < 24 bits it just won't work ) + y * bm.WidthBytes. Then you have three bytes to read, they are the blue, green and red values.

So, if you create a DIBSECTION that is the same size as your image, then you can step through and use memcpy to copy the data in, one row at a time. Bitmaps are padded to be word aligned, which is why you have the WidthBytes variable, it can be more than width*3. Your data may not be the same, otherwise I'd say just copy the whole lot in at once.

Hopefully that points you in the right direction. So your library is flattening the DICOM image and giving it to you as a BYTE * then ?



Christian Graus - Microsoft MVP - C++
GeneralRe: How to compress DICOM image to raw file format? Pin
Member 199230325-May-05 20:25
Member 199230325-May-05 20:25 
GeneralRe: How to compress DICOM image to raw file format? Pin
Christian Graus26-May-05 11:26
protectorChristian Graus26-May-05 11:26 
GeneralRe: How to compress DICOM image to raw file format? Pin
Member 199230329-May-05 19:43
Member 199230329-May-05 19:43 
GeneralImplementing DirectX on Visual Studio.NET 2003 Arc. Enterprise and 2005 Pin
shatterstar645725-May-05 12:54
shatterstar645725-May-05 12:54 
GeneralRe: Implementing DirectX on Visual Studio.NET 2003 Arc. Enterprise and 2005 Pin
Christian Graus25-May-05 15:56
protectorChristian Graus25-May-05 15:56 
GeneralRe: Implementing DirectX on Visual Studio.NET 2003 Arc. Enterprise and 2005 Pin
shatterstar645726-May-05 6:25
shatterstar645726-May-05 6:25 
GeneralRe: Implementing DirectX on Visual Studio.NET 2003 Arc. Enterprise and 2005 Pin
Christian Graus26-May-05 11:43
protectorChristian Graus26-May-05 11:43 
Generalthe S in writelines Pin
anaidu25-May-05 12:50
anaidu25-May-05 12:50 
GeneralRe: the S in writelines Pin
Christian Graus25-May-05 15:58
protectorChristian Graus25-May-05 15:58 
GeneralBinary to ASCII Pin
heng098725-May-05 12:27
heng098725-May-05 12:27 
GeneralRe: Binary to ASCII Pin
Christian Graus25-May-05 15:59
protectorChristian Graus25-May-05 15:59 
GeneralRe: Binary to ASCII Pin
heng098731-May-05 4:40
heng098731-May-05 4:40 
GeneralRe: Binary to ASCII Pin
heng098731-May-05 10:33
heng098731-May-05 10:33 
GeneralGetting it to work in Windows 2000 and Windows XP Pin
droozenrule@yahoo.com25-May-05 11:05
sussdroozenrule@yahoo.com25-May-05 11:05 
GeneralRe: Getting it to work in Windows 2000 and Windows XP Pin
Ravi Bhavnani25-May-05 11:32
professionalRavi Bhavnani25-May-05 11:32 
GeneralRe: Getting it to work in Windows 2000 and Windows XP Pin
Graham Bradshaw25-May-05 12:27
Graham Bradshaw25-May-05 12:27 
GeneralRe: Getting it to work in Windows 2000 and Windows XP Pin
droozenrule@yahoo.com26-May-05 11:22
sussdroozenrule@yahoo.com26-May-05 11:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.