Click here to Skip to main content
15,920,596 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
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 
sclh wrote:
StretchDIBits

This means you're using a DIB - this function is what draws it.

This code is ugly, it was obviously written by a C programmer who never learned C++ properly.

sclh wrote:
for(int s=1;s<=image_no;s++) {
n = 0;
for(int p=0;p for(int q=0;q data = image[s][n];
if (data <= 0) {
argb256Pixels[p][q] = (unsigned int)(0 | 0 | 0 | 0);
}
else {
argb256Pixels[p][q] = (unsigned int)(data<<24 | data<<16 | data<<8 | data);
}
n++;
}
}


This code ( which has been mangled because you didn't check 'Do not treat <'s as HTML tags') is copying the pixel values.


sclh wrote:
argbPixelsPtr = (unsigned char *) argb256Pixels;
rgbPixelsPtr = (unsigned char *) rgb256Pixels;

for (row=0; row for(col=0; col *rgbPixelsPtr++ = *argbPixelsPtr++;
*rgbPixelsPtr++ = *argbPixelsPtr++;
*rgbPixelsPtr++ = *argbPixelsPtr++;
argbPixelsPtr++;
}
}


This bit of code is copying from one image to another, one byte at a time. It's going from a 24 bit image to a 32 bit image. Goodness knows why.

Really, it seems to me like you have no idea what's happening here. Do your fellow students share your dismay ? If so, complain to the school that your teacher is no good. Assuming he wrote this code, he's definately not a person to be teaching C++.



Christian Graus - Microsoft MVP - C++
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 
Questionhow to completely remove a menu item during run-time Pin
elephantstar25-May-05 10:31
elephantstar25-May-05 10:31 
AnswerRe: how to completely remove a menu item during run-time Pin
Iain Clarke, Warrior Programmer26-May-05 1:32
Iain Clarke, Warrior Programmer26-May-05 1:32 

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.