(See Correction & Amplification below .)

For Craig (Keir Gilchrist), the depressed, anxious and momentarily suicidal Park Slope teenager at the center of the forthcoming film "It's Kind of a Funny Story," self-commitment to a psychiatric ward marks the first step toward a kind of shaggy-dog enlightenment. As he bonds with other patients, particularly the charismatic and considerably more troubled Bobby (Zach Galifianakis), Craig uses his time inside to test his bonds with his family, peer group and romantic interests on the outside, and the film transforms into a unique coming-of-age story grounded in modern-day Brooklyn reality and gilded with flights of magic realism.

The filmmakers on the set with Keir Gilchrist. K.C. Bailey

Bringing Ned Vizzini's 2006 novel to the screen also represented something of a coming-of-age story for the film's creators, the writing and directing team of Anna Boden and Ryan Fleck. Boasting a large ensemble cast that includes big- and small-screen marquee names such as Viola Davis and Lauren Graham, and supported by a bigger budget than their two previous films, "Half Nelson" and "Sugar," "It's Kind of a Funny Story" is the duo's first attempt at co-captaining a crew from the city's film guilds.

"It was a union show, our first," Ms. Boden, who also edited the film, said recently while awaiting coffee on a couch at the Waldorf Astoria alongside Mr. Fleck. "That was really different. Everything just felt much bigger."

For Mr. Fleck, one of the creative perks of the boost in crew complement was the fact that "a larger budget also afforded us the money for tools, bigger toys."

Incorporating animation effects, flashbacks, a fantasy musical number and voice-over, "It's Kind of a Funny Story" offered, as Ms. Boden put it, "an opportunity to have fun with some more cinematic elements than we'd been using in our first two movies, which were very much grounded in reality."

Keeping it real behind the camera was aided considerably by the couple's reliance on key prior collaborators, including cinematographer Andrej Parekh.

"It's nice to work with the same people," Ms. Boden said. "You don't have to be polite. You know each other's likes and dislikes, and you don't have to micromanage and look at what they're doing every moment."

Zach Galifianakis (left) and Mr. Gilchrist star in 'It's Kind of a Funny Story.' K.C. Bailey

Another central ingredient also carried over from their previous work: the dramatic primacy of New York City itself. The bracing downward spiral of Ryan Gosling's strung-out teacher in "Half Nelson" took place in Brooklyn. And the journey of Algenis Perz Soto's titular Dominican minor-league ballplayer in "Sugar" concluded with hard realities in the South Bronx.

"It's not like we have and agenda," Mr. Fleck said about his and Ms. Boden's third city-set directorial outing. "The book takes place in Brooklyn. So does the movie." New York, said the co-director, "is where we live and what we know, so it kind of falls in that way."

Nevertheless, collaborating with locally based talent while shooting in the Borough of Churches brought its own behind-the-scenes gravitas (Mr. Fleck and Ms. Boden both live in Park Slope). "Most of our crew lived in Brooklyn and it became just organically very much a Brooklyn movie," Mr. Fleck said. "Even though it's in the script, it just became more important."

The duo explained that the film's fictional Argenon Hospital was pieced together from three area facilities. A floor of Victory Memorial in Bay Ridge, which was awaiting renovation, was used for the film's main Three North clinic interior. "One of the things we learned in scouting is that there are a lot of vacant hospitals in the city, or at least a lot of vacant portions of hospitals," Mr. Fleck said.



Correction & Amplification

Anna Boden and Ryan Fleck are filmmaking partners, but aren't married and don't live together. This article incorrectly described them as a married couple.