In this paper we propose a methodology for brain parcellation with anatomical and functional constraints dedicated to fMRI data analysis. The aim is to provide a representation of fMRI data at any intermediate dimensionality between voxel and region of interest. In order to fill in the gap between these two approaches we developed an automatic parcellation of the 3D cortex with an adjustable resolution. The algorithm relies on an adaptation of the K-means clustering in a non convex domain with geodesic distances. Fine anatomical or functional constraints can be embedded through the use of weighted geodesic distances. The applications of such a method are principally connectivity studies, multivariate analyses and fusion with other modalities.