LEADTOOLS Support
Imaging
Imaging SDK Questions
How to load a bitmap from disc into a dataset, using SDK v15 and Visual C++ 6.0 ???
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Saturday, January 20, 2007 11:32:58 AM(UTC)
Groups: Registered
Posts: 5
I've been working with the Lead/Medicor Medical Imaging Suite SDK (v15) for a few weeks now under Visual C++ v6.0.
This must be straightforward, but I can't find any examples of doing it.
I need to load a bitmap file from disc into the PIXEL_DATA element.
The code I was trying is below, with questions contained within comments:
LDicomDS* pDS;
pDS = new LDicomDS(szTempFilesFolder);
pDS->InitDS(CLASS_VL_MICROSCOPIC_IMAGE_STORAGE, DS_METAHEADER_PRESENT |
DS_LITTLE_ENDIAN |
DS_EXPLICIT_VR |
DS_GROUP_LENGTHS);
// I populate patient ID and all that other good stuff
// now I need to load the BMP file into the dataset.
// Don't know how.
// This is what I started on reading about InsertImage() in the API
pDICOMELEMENT pElement = NULL;
L_INT32 lPhotoMetric = IMAGE_PHOTOMETRIC_PALETTE_COLOR;
L_INT32 lCompression = IMAGE_COMPRESSION_JPEG_LOSSLESS;
L_INT32 lBitDepth = 8;
L_INT32 lQuality = 2;
pBITMAPHANDLE pBitmap;
// what here?? how do I load the BMP file from the know path into this BITMAPHANDLE?
// you know, like I'd do this in MFC:
// HBITMAP hBmp = (HBITMAP)::LoadImage(NULL, sPath,IMAGE_BITMAP,0,0,LR_CREATEDIBSECTION |
LR_LOADFROMFILE);
nRet = pDS->InsertImage(pElement, pBitmap, 0, lCompression, lPhotoMetric, lBitDepth, lQuality, DICOM_SETIMAGE_AUTO_SET_VOI_LUT, NULL, NULL);
// now save it to a file.
pDS->SaveDS(_T("c:\\test_dicom.dic"), 0);
delete pDS;
EDIT: Additionally, why when I try to compile the above code I get unresolved external symbol errors during link? InsertImage() links fine, but SaveDS() does not:
DicomInterface.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: unsigned short __thiscall LDicomDS::SaveDS(unsigned short *,unsigned short)" (__imp_?SaveDS@LDicomDS@@QAEGPAGG@Z)
DicomInterface.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall LDicomDS::LDicomDS(unsigned short *)" (__imp_??0LDicomDS@@QAE@PAG@Z)
Thanks!
Paul
#2
Posted
:
Monday, January 22, 2007 5:46:02 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
To load the image, create an instance of LBitmapBase, call the Load
function to load the image, then call GetHandle to get the BITMAPHANDLE.
As for the link error, SaveDS requires Ltdic_u.lib in your project. You need to include it if you are not doing so.
#3
Posted
:
Monday, January 22, 2007 6:42:41 AM(UTC)
Groups: Registered
Posts: 5
Thanks Bashar.
edit: I had some more questions below about problems compiling, nevermind (if you happend to have already read them) I had failed to include LtWrappr.h
#4
Posted
:
Tuesday, January 23, 2007 12:33:19 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
No problem. Were you successful in loading the image?
#5
Posted
:
Tuesday, January 23, 2007 3:33:48 AM(UTC)
Groups: Registered
Posts: 5
Not yet - but that's because of the unresolved external symbol error I'm getting - I've posted another topic about that, here:
http://support.leadtools...rums/10949/ShowPost.aspxI'll update that thread in a bit. The demo at:
C:\Program Files\LEAD Technologies\LEADTOOLS 15\Examples\API\Dicom
did compile successfully on my machine
I'm going to see if I can start a new project with the includes and see if I can duplicate it.
#6
Posted
:
Sunday, January 28, 2007 7:52:20 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
You should be able to solve the linking problem by linking to
LTWVC2_U.LIB instead of LTWVC_U.LIB. Let me know if are still
unable to solve this issue.
LEADTOOLS Support
Imaging
Imaging SDK Questions
How to load a bitmap from disc into a dataset, using SDK v15 and Visual C++ 6.0 ???
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.