Moved imageCount function into study class