Accurately segmenting pancreas or pancreatic tumor from limited computed tomography (CT) scans plays an essential role in making a precise diagnosis and planning the surgical procedure for clinicians. Although deep convolutional neural networks have greatly advanced in automatic organ segmentation, there are still many challenges in solving the pancreas segmentation problem. To solve the segmentation problem of pancreas and pancreatic tumors with small areas and complex background, a new coarse-to-fine segmentation framework based on transform function and active localization offset was considered. Specifically, CT slices were input to the coarse segmentation network, and then the visual cues obtained by the coarse segmentation network were converted into spatial weights through a conversion function. At the same time, during the iterative execution of the coarse segmentation network, the ALOT module dynamically adjusted the localization of the target object, and obtained the cropped area with richer semantic information around the target to input to the fine segmentation network. Finally, the finer segmentation results were output by the fine segmentation network. Experiments in the NIH pancreas segmentation dataset and the MSD pancreatic tumor segmentation dataset shows that the framework achieves 85.15% (DSC) and 63.36% (DSC) on the NIH and MSD datasets, respectively, which are 0.25%, 0.5% higher than the previous best method, and the calculation time and calculation amounts only need about 1/3 of the best method. Code will be available on the author′s github personal homepage. [ABSTRACT FROM AUTHOR]