DICOM @ OFFIS

Discussion Forum for OFFIS DICOM Tools - For registration, send email with desired user name to the OFFIS DICOM team
It is currently Thu, 2017-08-17, 00:31

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: simple overlay example
PostPosted: Thu, 2008-02-14, 11:51 
Offline

Joined: Thu, 2008-02-14, 11:36
Posts: 1
I try to write a code to generate overlay in
presentation state and it not work.

Is possible to post a simple example?
thanks a lot.

it's my test code (it don't run):

Code:
int main(int argc, char *argv[])
{
  DcmFileFormat infile;
  DcmFileFormat outfile;
  if (infile.loadFile("/tmp/test.dcm").good())
  {
    printf("Caricata immagine dicom.\n");

    DVPresentationState pstate; // presentation state handler
    if (pstate.createFromImage(*infile.getDataset()).good())
    {
      pstate.addGraphicLayer("pippo", "prova pippo");
      size_t idl = pstate.getGraphicLayerIndex("pippo");
 
      printf("Numero layer %d idl=%d.\n", pstate.getNumberOfGraphicLayers(), idl);

      pstate.renderPixelData();

      // disegna nel ps
      DVPSTextObject *to = pstate.addTextObject(idl);
      if(to == NULL)
      {
        puts("niente DVPSTextObject");
      }
      else
      {
        to->setAnchorPoint(100.0, 100.0, DVPSA_pixels, true);
        to->setText("Hello World!");
      }

      // creates a new graphic object on the given layer.
      DVPSGraphicObject *go = pstate.addGraphicObject(idl);
      if(to == NULL)
      {
        puts("niente DVPSGraphicObject");
      }
      else
      {
      }

      // serialize presentation state into DICOM data set structure
      if (pstate.write(*outfile.getDataset(), OFFalse).good())
      {
        // and write to file
        outfile.saveFile("/tmp/gsps.dcm", EXS_LittleEndianExplicit);     
      }
    }
  }

  return 0;
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group