Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8771767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:52:23+00:00 2026-06-13T17:52:23+00:00

I’m trying to convert dicom .dcm file to .jpeg using Imebra in C++ app

  • 0

I’m trying to convert dicom .dcm file to .jpeg using Imebra in C++ app using Qt Creator as dev environment.

I’ve downloaded Imebra and was able to run Qt project example for Dicom2Jpeg conversion successfully. But when I tried to copy same code to my C++ app it failed to run with following error msg:

malloc: *** error for object xxxxxx: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

I have followed steps on adding Imebra files to my project as it was shown on Imebra site. Also used their qt project as example. My main.cpp open dicom file, then loads it to dataset, then calls my dialog window. It crashes on loading dataset.

#include "QApplication.h"
#include "QHBoxLayout.h"
#include "mydialog.h"
#include "iostream.h"

include "library/imebra/include/imebra.h"
int main( int argc, char ** argv ){

    using namespace puntoexe;
    ptr<stream> readStream(new stream);
    readStream->openFile("/pathToDcmFile/test.dcm",std::ios_base::in);

    ptr<streamReader> reader(new streamReader(readStream));

    ptr<imebra::codecs::codecFactory> 
    cFactory(imebra::codecs::codecFactory::getCodecFactory());
    ptr<imebra::dataSet> tdataSet;
    tdataSet=cFactory->load(reader,2048);

    Q_INIT_RESOURCE(images);

    QApplication a( argc, argv );

    MyDialog md;
    md.show();

    return a.exec();

}

Deeper debugging showed that source of error is in JpegCodec.cpp file readStream() function when checking JpegSignature to see if it’s in wrong format with resulting internal PUNTOEXE error “detected a wrong format”.

Interesting thing is that while running same test dcm file using given dicom2jpeg example (which has exact same code of opening file and loading it) gives no errors and converts to jpeg successfully. So I know it’s not the file issue, but the way imebra code is integrated into my C++ app.

My dev environment: macbook pro with Lion OS, Qt Creator, Qt project, C++ code, ITK library added, Imebra files are completely integrated as part of the Qt project.

So, my question is how do I work/link/reference/call Imebra functionality in Qt project? Am I forgetting to link something, or some object is not instantiated/deleted on time?

Any ideas are highly appreciated,

Evushka

Solution: As it was suggested I have changed codec factory to dicm factory and it fixed the problem. My new code is given below.

imebra::codecs::dicomCodec* pTmp = new imebra::codecs::dicomCodec();

ptr<stream> readStream(new stream);
readStream->openFile(argv[0],std::ios_base::in);

ptr<streamReader> reader(new streamReader(readStream));

ptr<imebra::dataSet> tdataSet;
tdataSet=pTmp->read(reader,2048);

delete pTmp;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:52:24+00:00Added an answer on June 13, 2026 at 5:52 pm

    The error “detected a wrong format” is thrown because the library checks the file against all the file formats, and since you are reading a Dicom file then the Jpeg code throws an exception, but this should be recovered by the codec factory. You may be a victim of this bug: https://bitbucket.org/puntoexe/imebra/issue/89/ which prevents the Dicom codec from registering statically at startup, causing the factory codec to skip the Dicom codec entirely. The bug report also contains a workaround.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to render a haml file in a javascript response like so:
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I am using Paperclip to handle profile photo uploads in my app. They upload
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.