The document proposes a novel algorithm to diagnose lung cancer using medical images. It involves preprocessing images using a fast non-local mean filter, segmenting images using Masi entropy-based multilevel thresholding with a salp swarm algorithm, extracting features using gray level run length matrix, selecting features with a binary grasshopper optimization algorithm, and classifying images using a hybrid deep neural network with adaptive sine cosine crow search. The algorithm aims to accurately classify lung cancer at early stages, achieve high classification accuracy by optimally extracting features, and minimize classification errors and execution time. It is tested on lung images from publicly available databases and shows improvements over other methods.