An apparatus comprising: an insertion tube; an image sensor inside the insertion tube; wherein the image sensor comprises an array of pixels; wherein the image sensor is configured to count numbers of particles of radiation incident on the pixels, within a period of time; wherein the image sensor comprises: a radiation absorption layer comprising an electric contact; a first voltage comparator configured to compare a voltage of the electric contact to a first threshold; a second voltage comparator configured to compare the voltage to a second threshold; a counter configured to register at least one of the numbers; a controller; wherein the controller is configured to start a time delay from a time at which the first voltage comparator determines that an absolute value of the voltage equals or exceeds an absolute value of the first threshold; wherein the controller is configured to activate the second voltage comparator during the time delay; wherein the controller is configured to cause the at least one of the numbers to increase by one, when the second voltage comparator determines that an absolute value of the voltage equals or exceeds an absolute value of the second threshold; wherein the radiation absorption layer comprises single-crystalline silicon; and wherein the image sensor is flexible. an insertion tube; an image sensor inside the insertion tube; wherein the image sensor comprises an array of pixels; wherein the image sensor is configured to count numbers of particles of radiation incident on the pixels, within a period of time; wherein the image sensor comprises: a radiation absorption layer comprising an electric contact; a first voltage comparator configured to compare a voltage of the electric contact to a first threshold; a second voltage comparator configured to compare the voltage to a second threshold; a counter configured to register at least one of the numbers; a controller; wherein the controller is configured to start a time delay from a time at which the first voltage comparator determines that an absolute value of the voltage equals or exceeds an absolute value of the first threshold; wherein the controller is configured to activate the second voltage comparator during the time delay; wherein the controller is configured to cause the at least one of the numbers to increase by one, when the second voltage comparator determines that an absolute value of the voltage equals or exceeds an absolute value of the second threshold; wherein the radiation absorption layer comprises single-crystalline silicon; and wherein the image sensor is flexible. a radiation absorption layer comprising an electric contact; a first voltage comparator configured to compare a voltage of the electric contact to a first threshold; a second voltage comparator configured to compare the voltage to a second threshold; a counter configured to register at least one of the numbers; a controller; wherein the controller is configured to start a time delay from a time at which the first voltage comparator determines that an absolute value of the voltage equals or exceeds an absolute value of the first threshold; wherein the controller is configured to activate the second voltage comparator during the time delay; wherein the controller is configured to cause the at least one of the numbers to increase by one, when the second voltage comparator determines that an absolute value of the voltage equals or exceeds an absolute value of the second threshold; wherein the radiation absorption layer comprises single-crystalline silicon; and wherein the image sensor is flexible.