The morphology and optical properties of polyimides and polyestermides