Sunday, 15 January 2012

c++ - how to modify image pixels in DICOM files using Imebra library? -



c++ - how to modify image pixels in DICOM files using Imebra library? -

i utilize imerba library read dicom files. need acces pixels can modify them in low level. documentation says: "in order access image's pixels have retrieve info handler" , there's example:

imbxuint32 rowsize, channelpixelsize, channelsnumber; ptr<imebra::handlers::datahandlernumericbase> myhandler = presentationimage->getdatahandler(true, &rowsize, &channelpixelsize, &channelsnumber); // retrieve image's size in pixels imbxuint32 sizex, sizey; presentationimage->getsize(&sizex, &sizey); // scan rows imbxuint32 index(0); for(imbxuint32 scany = 0; scany < sizey; ++scany) { // scan columns for(imbxuint32 scanx = 0; scanx < sizex; ++scanx) { // scan channels for(imbxuint32 scanchannel = 0; scanchannel < channelsnumber; ++scanchannel) { imbxint32 channelvalue = myhandler->getsignedlong(index++); // channel's value //-------------------------------------- } }

} need presentationimage object pixels changed. i've tried alter in way like:

myhandler->setsignedlong(index,255);

but doesn't alter presentationimage object , i'm sure way. imebra documentation has 3 examples , classes , methods description bit raw. google knows nil well. how alter pixel values in object?

when modify buffer modifying uncompressed image: original dicom construction still contains compressed image.

in order replace image in dicom file have set image dataset using dataset::setimage after datahandler goes out of scope (the info written image when datahandler destroyed)

c++ image-processing dicom

No comments:

Post a Comment