Dicey grounds here, but it should be legal to imagine _anything_. Thoughtcrimes are always wrong, and there never should be any law on what you can think or imagine.
If it were a crime we'd likely have to repeatedly arrest every single student until they got out of high school. The curiosity of children and the hormones of puberty make the crime of imaging a certainty.