Copies part of an image from another matrix layer
Copies part of image from another matrix layer
It copies only the part of image in source matrix layer that is within grObject
BOOL CopyImage( MatrixLayer SrcLayer, int left, int top, int right, int bottom, BOOL bUndo = TRUE )
BOOL CopyImage( MatrixLayer SrcLayer, GraphObject grObject, BOOL bUndo = TRUE )
TRUE if success; otherwise FALSE
TRUE if success; otherwise FALSE
EX1
void MatrixLayer_CopyImage_Ex1() { MatrixPage mp = Project.MatrixPages(0); if(!mp) return; MatrixLayer ml(mp.GetName()); if( !ml ) return; MatrixPage mpCpy; mpCpy.Create("origin.otm"); MatrixLayer mlCpy = mpCpy.Layers(); if(mlCpy) { BOOL bOK = mlCpy.CopyImage(ml, 0, 0, ml.GetNumCols(), ml.GetNumRows() , FALSE); if(bOK && ml.HasImage()) { mlCpy.SetViewImage(TRUE); printf("Success to copy image!"); } else if( !bOK ) printf("Fail to copy images!"); } }
EX2
BOOL MatrixLayer_CopyImage_Ex2(string strObjectName = "ROI", string strMatrixName = "Matrix1") { MatrixPage mp = Project.MatrixPages(0); if(!mp) return FALSE; MatrixLayer SrcMatrix(mp.GetName()); GraphObject grObject; grObject = SrcMatrix.GraphObjects(strObjectName); MatrixLayer DestMatrix; BOOL bReturn = FALSE; DestMatrix.Create(); DestMatrix.SetInternalData(SrcMatrix.GetInternalData(), FALSE, FALSE); bReturn = DestMatrix.CopyImage(SrcMatrix, grObject, FALSE); if( !bReturn ) DestMatrix.Destroy(); if( bReturn ) printf("Success to copy image!"); else printf("Fail to copy image!"); return bReturn; }
origin.h