This study presents a novel algorithm for assembling cell pore structure to enhance the connectivity of porous medium used in the medical science. Firstly based on sample learning, the designed cell pore structure is assembled and thus the parametric pore model can be established. Then the model is optimized by using random decision forests as evaluator and KD tree as the nearest neighbor searching area in the high dimensional space. Finally the parametric model can be transformed to solid model for evaluating the robustness of the proposed algorithm with the aid of the second development platform of UG. The test verifies that the proposed method can assemble and optimize the established cell pore model and thus significantly improve the correlation among cell models and successfully solve the difficult problem that the connectivity among cell models can't easily be controlled.