A new model is proposed to a collapsing star consisting of an initial inhomogeneous energy density and anisotropic pressure fluid with shear, radial heat flow and outgoing radiation. In previous papers one of us has always assumed an initial star with homogeneous energy density. The aim of this work is to generalize the previous models by introducing an initial inhomogeneous energy density and compare it to the initial homogeneous energy density collapse model. We will show the differences between these models in the evolution of all physical quantities that characterizes the gravitational collapse. The behavior of the energy density, pressure, mass, luminosity and the effective adiabatic index is analyzed. The pressure of the star, at the beginning of the collapse, is isotropic but due to the presence of the shear the pressure becomes more and more anisotropic. The black hole is never formed because the apparent horizon formation condition is never satisfied, in contrast of the previous model where a black hole is formed. An observer at infinity sees a radial point source radiating exponentially until reaches the time of maximum luminosity and suddenly the star turns off. In contrast of the former model where the luminosity also increases exponentially, reaching a maximum and after it decreases until the formation of the black hole. The effective adiabatic index is always positive without any discontinuity in contrast of the former model where there is a discontinuity around the time of maximum luminosity. The collapse is about three thousand times slower than in the case where the energy density is initially homogeneous.