How to reduce size of the stl file generated through python script?

@techrama Would you like to tell us what the code snippet above is supposed to do?

@Siddharth_Sharma You can decrease size & quality of the generated mesh by adding this line before CreateClosedSurfaceRepresentation method call:

segmentationNode.GetSegmentation().SetConversionParameter("Decimation factor", "0.9") 

The parameter value is between 0.0-1.0 and it specifies the fraction points that you would like to remove from the mesh.