A system for detecting a spinal injury region containing injured spinal nerve cells may include a swarm of nanosensors that are configured to detect chemical signals released by the injured spinal nerve cells, and are coated with a magnetic material. A magnetic field generator may controllably generate a magnetic field so as to magnetically levitate the magnetically coated nanosensors. An imaging subsystem may detect the positions of the nanosensors. A controller may control the intensity and direction of the magnetic field in a feedback loop, in response to the detected positions of the nanosensors, so that the attractive force that attracts each nanosensor toward the injured spinal cell as a result of the chemical affinity of the nanosensor is iteratively supplemented by the magnetic levitation force applied to that nanosensor, until substantially all of the nanosensors are agglutinated around the spinal injury region.