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: Select all
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;
}